(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.videojsContribHls=e()}})(function(){var e,t,i;return function e(t,i,r){function n(s,o){if(!i[s]){if(!t[s]){var u=typeof require=="function"&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[s]={exports:{}};t[s][0].call(d.exports,function(e){var i=t[s][1][e];return n(i?i:e)},d,d.exports,e,t,i,r)}return i[s].exports}var a=typeof require=="function"&&require;for(var s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){var i=[];var r=true;var n=false;var a=undefined;try{for(var s=e[Symbol.iterator](),o;!(r=(o=s.next()).done);r=true){i.push(o.value);if(t&&i.length===t)break}}catch(e){n=true;a=e}finally{try{if(!r&&s["return"])s["return"]()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return e(t,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();function n(e){return e&&e.__esModule?e:{default:e}}var a=e("global/window");var s=n(a);var o=function e(t,i){var r=t.cues;for(var n=0;n<r.length;n++){var a=r[n];if(i>=a.adStartTime&&i<=a.adEndTime){return a}}return null};var u=function e(t,i){var n=arguments.length<=2||arguments[2]===undefined?0:arguments[2];if(!t.segments){return}var a=n;var u=undefined;for(var f=0;f<t.segments.length;f++){var d=t.segments[f];if(!u){u=o(i,a+d.duration/2)}if(u){if("cueIn"in d){u.endTime=a;u.adEndTime=a;a+=d.duration;u=null;continue}if(a<u.endTime){a+=d.duration;continue}u.endTime+=d.duration}else{if("cueOut"in d){u=new s["default"].VTTCue(a,a+d.duration,d.cueOut);u.adStartTime=a;u.adEndTime=a+parseFloat(d.cueOut);i.addCue(u)}if("cueOutCont"in d){var l=undefined;var c=undefined;var h=d.cueOutCont.split("/").map(parseFloat);var p=r(h,2);l=p[0];c=p[1];u=new s["default"].VTTCue(a,a+d.duration,"");u.adStartTime=a-l;u.adEndTime=u.adStartTime+c;i.addCue(u)}}a+=d.duration}};i["default"]={updateAdCues:u,findAdCue:o};t.exports=i["default"]},{"global/window":28}],2:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function e(t,i){return t.start(i)+"-"+t.end(i)};var n=function e(t,i){var r=t.toString(16);return"00".substring(0,2-r.length)+r+(i%2?" ":"")};var a=function e(t){if(t>=32&&t<126){return String.fromCharCode(t)}return"."};var s=function e(t){var i={};Object.keys(t).forEach(function(e){var r=t[e];if(ArrayBuffer.isView(r)){i[e]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}}else{i[e]=r}});return i};var o={hexDump:function e(t){var i=Array.prototype.slice.call(t);var r=16;var s="";var o=undefined;var u=undefined;for(var f=0;f<i.length/r;f++){o=i.slice(f*r,f*r+r).map(n).join("");u=i.slice(f*r,f*r+r).map(a).join("");s+=o+" "+u+"\n"}return s},tagDump:function e(t){return o.hexDump(t.bytes)},textRanges:function e(t){var i="";var n=undefined;for(n=0;n<t.length;n++){i+=r(t,n)+" "}return i},createTransferableMessage:s};i["default"]=o;t.exports=i["default"]},{}],3:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});i["default"]={GOAL_BUFFER_LENGTH:30};t.exports=i["default"]},{}],4:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=e("global/window");var a=r(n);var s=e("aes-decrypter");var o=e("./bin-utils");var u=function e(t){t.onmessage=function(e){var t=e.data;var i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength);var r=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4);var n=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new s.Decrypter(i,r,n,function(e,i){a["default"].postMessage((0,o.createTransferableMessage)({source:t.source,decrypted:i}),[i.buffer])})}};i["default"]=function(e){return new u(e)};t.exports=i["default"]},{"./bin-utils":2,"aes-decrypter":21,"global/window":28}],5:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var n=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function o(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var u=e("./playlist-loader");var f=a(u);var d=e("./segment-loader");var l=a(d);var c=e("./ranges");var h=a(c);var p=typeof window!=="undefined"?window["videojs"]:typeof t!=="undefined"?t["videojs"]:null;var m=a(p);var v=e("./ad-cue-tags");var y=a(v);var g=e("./sync-controller");var b=a(g);var _=e("videojs-contrib-media-sources/es5/codec-utils");var T=e("webworkify");var w=a(T);var S=e("./decrypter-worker");var k=a(S);var O=5*60*1e3;var P=undefined;var A=function e(t,i){if(typeof t!==typeof i){return true}if(Object.keys(t).length!==Object.keys(i).length){return true}for(var r in t){if(t[r]!==i[r]){return true}}return false};var E=function e(t){var i={codecCount:0,videoCodec:null,videoObjectTypeIndicator:null,audioProfile:null};var r=undefined;i.codecCount=t.split(",").length;i.codecCount=i.codecCount||2;r=/(^|\s|,)+(avc1)([^ ,]*)/i.exec(t);if(r){i.videoCodec=r[2];i.videoObjectTypeIndicator=r[3]}i.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t);i.audioProfile=i.audioProfile&&i.audioProfile[2];return i};var x=function e(t){return t.replace(/avc1\.(\d+)\.(\d+)/i,function(e){return(0,_.translateLegacyCodecs)([e])[0]})};i.mapLegacyAvcCodecs_=x;var L=function e(t,i){var r="mp2t";var n={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"};var a=[];var s=undefined;var o=null;if(!i){return[]}if(i.segments&&i.segments.length&&i.segments[0].map){r="mp4"}s=i.attributes||{};if(s.CODECS){(function(){var e=E(s.CODECS);Object.keys(e).forEach(function(t){n[t]=e[t]||n[t]})})()}if(t.mediaGroups.AUDIO){a=t.mediaGroups.AUDIO[s.AUDIO]}for(var u in a){if(o&&!!a[u].uri!==!!o.uri){return["video/"+r+'; codecs="'+n.videoCodec+n.videoObjectTypeIndicator+", mp4a.40."+n.audioProfile+'"',"audio/"+r+'; codecs="mp4a.40.'+n.audioProfile+'"']}o=a[u]}if(o&&o.uri){return["video/"+r+'; codecs="'+n.videoCodec+n.videoObjectTypeIndicator+'"',"audio/"+r+'; codecs="mp4a.40.'+n.audioProfile+'"']}return["video/"+r+'; codecs="'+n.videoCodec+n.videoObjectTypeIndicator+", mp4a.40."+n.audioProfile+'"']};i.mimeTypesForPlaylist_=L;var I=function(e){o(t,e);function t(e){var i=this;s(this,t);n(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var r=e.url;var a=e.withCredentials;var o=e.mode;var u=e.tech;var d=e.bandwidth;var c=e.externHls;var h=e.useCueTags;if(!r){throw new Error("A non-empty playlist URL is required")}P=c;this.withCredentials=a;this.tech_=u;this.hls_=u.hls;this.mode_=o;this.useCueTags_=h;if(this.useCueTags_){this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues");this.cueTagsTrack_.inBandMetadataTrackDispatchType=""}this.audioTracks_=[];this.requestOptions_={withCredentials:this.withCredentials,timeout:null};this.audioGroups_={};this.mediaSource=new m["default"].MediaSource({mode:o});this.audioinfo_=null;this.mediaSource.on("audioinfo",this.handleAudioinfoUpdate_.bind(this));this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_.bind(this));this.seekable_=m["default"].createTimeRanges();this.hasPlayed_=function(){return false};this.syncController_=new b["default"];this.decrypter_=(0,w["default"])(k["default"]);var p={hls:this.hls_,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:function e(){return i.seekable()},seeking:function e(){return i.tech_.seeking()},setCurrentTime:function e(t){return i.tech_.setCurrentTime(t)},hasPlayed:function e(){return i.hasPlayed_()},bandwidth:d,syncController:this.syncController_,decrypter:this.decrypter_,loaderType:"main"};this.masterPlaylistLoader_=new f["default"](r,this.hls_,this.withCredentials);this.setupMasterPlaylistLoaderListeners_();this.audioPlaylistLoader_=null;this.mainSegmentLoader_=new l["default"](p);p.loaderType="audio";this.audioSegmentLoader_=new l["default"](p);this.decrypter_.onmessage=function(e){if(e.data.source==="main"){i.mainSegmentLoader_.handleDecrypted_(e.data)}else if(e.data.source==="audio"){i.audioSegmentLoader_.handleDecrypted_(e.data)}};this.setupSegmentLoaderListeners_();this.masterPlaylistLoader_.start()}r(t,[{key:"setupMasterPlaylistLoaderListeners_",value:function e(){var t=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var e=t.masterPlaylistLoader_.media();var i=t.masterPlaylistLoader_.targetDuration*1.5*1e3;t.requestOptions_.timeout=i;if(e.endList&&t.tech_.preload()!=="none"){t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.mainSegmentLoader_.load()}t.fillAudioTracks_();t.setupAudio();try{t.setupSourceBuffers_()}catch(e){m["default"].log.warn("Failed to create SourceBuffers",e);return t.mediaSource.endOfStream("decode")}t.setupFirstPlay();t.trigger("audioupdate");t.trigger("selectedinitialmedia")});this.masterPlaylistLoader_.on("loadedplaylist",function(){var e=t.masterPlaylistLoader_.media();if(!e){t.initialMedia_=t.selectPlaylist();t.masterPlaylistLoader_.media(t.initialMedia_);return}if(t.useCueTags_){t.updateAdCues_(e)}t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.updateDuration();if(!e.endList){(function(){var e=function e(){var i=t.seekable();if(i.length!==0){t.mediaSource.addSeekableRange_(i.start(0),i.end(0))}};if(t.duration()!==Infinity){(function(){var i=function i(){if(t.duration()===Infinity){e()}else{t.tech_.one("durationchange",i)}};t.tech_.one("durationchange",i)})()}else{e()}})()}});this.masterPlaylistLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.masterPlaylistLoader_.error)});this.masterPlaylistLoader_.on("mediachanging",function(){t.mainSegmentLoader_.abort();t.mainSegmentLoader_.pause()});this.masterPlaylistLoader_.on("mediachange",function(){var e=t.masterPlaylistLoader_.media();var i=t.masterPlaylistLoader_.targetDuration*1.5*1e3;var r=undefined;var n=undefined;if(t.masterPlaylistLoader_.isLowestEnabledRendition_()){t.requestOptions_.timeout=0}else{t.requestOptions_.timeout=i}t.mainSegmentLoader_.playlist(e,t.requestOptions_);t.mainSegmentLoader_.load();r=t.activeAudioGroup();n=r.filter(function(e){return e.enabled})[0];if(!n){t.setupAudio();t.trigger("audioupdate")}t.tech_.trigger({type:"mediachange",bubbles:true})})}},{key:"setupSegmentLoaderListeners_",value:function e(){var t=this;this.mainSegmentLoader_.on("progress",function(){t.masterPlaylistLoader_.media(t.selectPlaylist());t.trigger("progress")});this.mainSegmentLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.mainSegmentLoader_.error())});this.mainSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()});this.audioSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()});this.audioSegmentLoader_.on("error",function(){m["default"].log.warn("Problem encountered with the current alternate audio track"+". Switching back to default.");t.audioSegmentLoader_.abort();t.audioPlaylistLoader_=null;t.setupAudio()})}},{key:"handleAudioinfoUpdate_",value:function e(t){if(P.supportsAudioInfoChange_()||!this.audioInfo_||!A(this.audioInfo_,t.info)){this.audioInfo_=t.info;return}var i="had different audio properties (channels, sample rate, etc.) "+"or changed in some other way.  This behavior is currently "+"unsupported in Firefox 48 and below due to an issue: \n\n"+"https://bugzilla.mozilla.org/show_bug.cgi?id=1247138\n\n";var r=this.activeAudioGroup().map(function(e){return e.enabled}).indexOf(true);var n=this.activeAudioGroup()[r];var a=this.activeAudioGroup().filter(function(e){return e.properties_&&e.properties_["default"]})[0];if(!this.audioPlaylistLoader_){i="The rendition that we tried to switch to "+i+"Unfortunately that means we will have to blacklist "+"the current playlist and switch to another. Sorry!";this.blacklistCurrentPlaylist()}else{i="The audio track '"+n.label+"' that we tried to "+("switch to "+i+" Unfortunately this means we will have to ")+("return you to the main track '"+a.label+"'. Sorry!");a.enabled=true;this.activeAudioGroup().splice(r,1);this.trigger("audioupdate")}m["default"].log.warn(i);this.setupAudio()}},{key:"mediaRequests_",value:function e(){return this.audioSegmentLoader_.mediaRequests+this.mainSegmentLoader_.mediaRequests}},{key:"mediaTransferDuration_",value:function e(){return this.audioSegmentLoader_.mediaTransferDuration+this.mainSegmentLoader_.mediaTransferDuration}},{key:"mediaBytesTransferred_",value:function e(){return this.audioSegmentLoader_.mediaBytesTransferred+this.mainSegmentLoader_.mediaBytesTransferred}},{key:"mediaSecondsLoaded_",value:function e(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"fillAudioTracks_",value:function e(){var t=this.master();var i=t.mediaGroups||{};if(!i||!i.AUDIO||Object.keys(i.AUDIO).length===0||this.mode_!=="html5"){i.AUDIO={main:{default:{default:true}}}}for(var r in i.AUDIO){if(!this.audioGroups_[r]){this.audioGroups_[r]=[]}for(var n in i.AUDIO[r]){var a=i.AUDIO[r][n];var s=new m["default"].AudioTrack({id:n,kind:a["default"]?"main":"alternative",enabled:false,language:a.language,label:n});s.properties_=a;this.audioGroups_[r].push(s)}}(this.activeAudioGroup().filter(function(e){return e.properties_["default"]})[0]||this.activeAudioGroup()[0]).enabled=true}},{key:"load",value:function e(){this.mainSegmentLoader_.load();if(this.audioPlaylistLoader_){this.audioSegmentLoader_.load()}}},{key:"activeAudioGroup",value:function e(){var t=this.masterPlaylistLoader_.media();var i=undefined;if(t.attributes&&t.attributes.AUDIO){i=this.audioGroups_[t.attributes.AUDIO]}return i||this.audioGroups_.main}},{key:"setupAudio",value:function e(){var t=this;var i=this.activeAudioGroup();var r=i.filter(function(e){return e.enabled})[0];if(!r){r=i.filter(function(e){return e.properties_["default"]})[0]||i[0];r.enabled=true}if(this.audioPlaylistLoader_){this.audioPlaylistLoader_.dispose();this.audioPlaylistLoader_=null}this.audioSegmentLoader_.pause();if(!r.properties_.resolvedUri){this.mainSegmentLoader_.resetEverything();return}this.audioSegmentLoader_.resetEverything();this.audioPlaylistLoader_=new f["default"](r.properties_.resolvedUri,this.hls_,this.withCredentials);this.audioPlaylistLoader_.start();this.audioPlaylistLoader_.on("loadedmetadata",function(){var e=t.audioPlaylistLoader_.media();t.audioSegmentLoader_.playlist(e,t.requestOptions_);if(!t.tech_.paused()||e.endList&&t.tech_.preload()!=="none"){t.audioSegmentLoader_.load()}if(!e.endList){t.audioPlaylistLoader_.trigger("firstplay")}});this.audioPlaylistLoader_.on("loadedplaylist",function(){var e=undefined;if(t.audioPlaylistLoader_){e=t.audioPlaylistLoader_.media()}if(!e){t.audioPlaylistLoader_.media(t.audioPlaylistLoader_.playlists.master.playlists[0]);return}t.audioSegmentLoader_.playlist(e,t.requestOptions_)});this.audioPlaylistLoader_.on("error",function(){m["default"].log.warn("Problem encountered loading the alternate audio track"+". Switching back to default.");t.audioSegmentLoader_.abort();t.setupAudio()})}},{key:"fastQualityChange_",value:function e(){var t=this.selectPlaylist();if(t!==this.masterPlaylistLoader_.media()){this.masterPlaylistLoader_.media(t);this.mainSegmentLoader_.resetLoader();if(this.audiosegmentloader_){this.audioSegmentLoader_.resetLoader()}}}},{key:"play",value:function e(){if(this.setupFirstPlay()){return}if(this.tech_.ended()){this.tech_.setCurrentTime(0)}if(this.hasPlayed_()){this.load()}if(this.tech_.duration()===Infinity){if(this.tech_.currentTime()<this.tech_.seekable().start(0)){return this.tech_.setCurrentTime(this.tech_.seekable().start(0))}}}},{key:"setupFirstPlay",value:function e(){var t=undefined;var i=this.masterPlaylistLoader_.media();if(i&&!this.tech_.paused()&&!this.hasPlayed_()){if(!i.endList){this.trigger("firstplay");t=this.seekable();if(t.length){this.tech_.setCurrentTime(t.end(0))}}this.hasPlayed_=function(){return true};this.load();return true}return false}},{key:"handleSourceOpen_",value:function e(){try{this.setupSourceBuffers_()}catch(e){m["default"].log.warn("Failed to create Source Buffers",e);return this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){this.tech_.play()}this.trigger("sourceopen")}},{key:"blacklistCurrentPlaylist",value:function e(){var t=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];var i=undefined;var r=undefined;i=t.playlist||this.masterPlaylistLoader_.media();if(!i){this.error=t;return this.mediaSource.endOfStream("network")}i.excludeUntil=Date.now()+O;r=this.selectPlaylist();if(r){m["default"].log.warn("Problem encountered with the current "+"HLS playlist. Switching to another playlist.");return this.masterPlaylistLoader_.media(r)}m["default"].log.warn("Problem encountered with the current "+"HLS playlist. No suitable alternatives found.");this.error=t;return this.mediaSource.endOfStream("network")}},{key:"pauseLoading",value:function e(){this.mainSegmentLoader_.pause();if(this.audioPlaylistLoader_){this.audioSegmentLoader_.pause()}}},{key:"setCurrentTime",value:function e(t){var i=h["default"].findRange(this.tech_.buffered(),t);if(!(this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media())){return 0}if(!this.masterPlaylistLoader_.media().segments){return 0}if(i&&i.length){return t}this.mainSegmentLoader_.resetEverything();this.mainSegmentLoader_.abort();if(this.audioPlaylistLoader_){this.audioSegmentLoader_.resetEverything();this.audioSegmentLoader_.abort()}if(!this.tech_.paused()){this.mainSegmentLoader_.load();if(this.audioPlaylistLoader_){this.audioSegmentLoader_.load()}}}},{key:"duration",value:function e(){if(!this.masterPlaylistLoader_){return 0}if(this.mediaSource){return this.mediaSource.duration}return P.Playlist.duration(this.masterPlaylistLoader_.media())}},{key:"seekable",value:function e(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function e(){var t=undefined;var i=undefined;var r=undefined;if(!this.masterPlaylistLoader_){return}t=this.masterPlaylistLoader_.media();if(!t){return}i=P.Playlist.seekable(t);if(i.length===0){return}if(this.audioPlaylistLoader_){r=P.Playlist.seekable(this.audioPlaylistLoader_.media());if(r.length===0){return}}if(!r){this.seekable_=i;return}this.seekable_=m["default"].createTimeRanges([[r.start(0)>i.start(0)?r.start(0):i.start(0),r.end(0)<i.end(0)?r.end(0):i.end(0)]])}},{key:"updateDuration",value:function e(){var t=this;var i=this.mediaSource.duration;var r=P.Playlist.duration(this.masterPlaylistLoader_.media());var n=this.tech_.buffered();var a=function e(){t.mediaSource.duration=r;t.tech_.trigger("durationchange");t.mediaSource.removeEventListener("sourceopen",e)};if(n.length>0){r=Math.max(r,n.end(n.length-1))}if(i!==r){if(this.mediaSource.readyState!=="open"){this.mediaSource.addEventListener("sourceopen",a)}else{a()}}}},{key:"dispose",value:function e(){this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();if(this.audioPlaylistLoader_){this.audioPlaylistLoader_.dispose()}this.audioSegmentLoader_.dispose()}},{key:"master",value:function e(){return this.masterPlaylistLoader_.master}},{key:"media",value:function e(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function e(){var t=this.masterPlaylistLoader_.media();var i=undefined;if(!t||this.mediaSource.readyState!=="open"){return}i=L(this.masterPlaylistLoader_.master,t);if(i.length<1){this.error="No compatible SourceBuffer configuration for the variant stream:"+t.resolvedUri;return this.mediaSource.endOfStream("decode")}this.mainSegmentLoader_.mimeType(i[0]);if(i[1]){this.audioSegmentLoader_.mimeType(i[1])}this.excludeIncompatibleVariants_(t)}},{key:"excludeIncompatibleVariants_",value:function e(t){var i=this.masterPlaylistLoader_.master;var r=2;var n=null;var a=undefined;if(t.attributes&&t.attributes.CODECS){a=E(t.attributes.CODECS);n=a.videoCodec;r=a.codecCount}i.playlists.forEach(function(e){var t={codecCount:2,videoCodec:null};if(e.attributes&&e.attributes.CODECS){var i=e.attributes.CODECS;t=E(i);if(window.MediaSource&&window.MediaSource.isTypeSupported&&!window.MediaSource.isTypeSupported('video/mp4; codecs="'+x(i)+'"')){e.excludeUntil=Infinity}}if(t.codecCount!==r){e.excludeUntil=Infinity}if(t.videoCodec!==n){e.excludeUntil=Infinity}})}},{key:"updateAdCues_",value:function e(t){var i=0;var r=this.seekable();if(r.length){i=r.start(0)}y["default"].updateAdCues(t,this.cueTagsTrack_,i)}}]);return t}(m["default"].EventTarget);i.MasterPlaylistController=I}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./ad-cue-tags":1,"./decrypter-worker":4,"./playlist-loader":7,"./ranges":9,"./segment-loader":13,"./sync-controller":16,"videojs-contrib-media-sources/es5/codec-utils":44,webworkify:77}],6:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var o=e("./ranges");var u=a(o);var f=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var d=a(f);var l=["seeking","seeked","pause","playing","error"];var c=function(){function e(t){var i=this;s(this,e);this.tech_=t.tech;this.seekable=t.seekable;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;if(t.debug){this.logger_=d["default"].log.bind(d["default"],"playback-watcher ->")}this.logger_("initialize");var r=function e(){return i.waiting_()};var n=function e(){return i.cancelTimer_()};this.tech_.on("waiting",r);this.tech_.on(l,n);this.monitorCurrentTime_();this.dispose=function(){i.logger_("dispose");i.tech_.off("waiting",r);i.tech_.off(l,n);if(i.checkCurrentTimeTimeout_){clearTimeout(i.checkCurrentTimeTimeout_)}i.cancelTimer_()}}n(e,[{key:"monitorCurrentTime_",value:function e(){this.checkCurrentTime_();if(this.checkCurrentTimeTimeout_){clearTimeout(this.checkCurrentTimeTimeout_)}this.checkCurrentTimeTimeout_=setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function e(){if(this.tech_.paused()||this.tech_.seeking()){return}var t=this.tech_.currentTime();if(this.consecutiveUpdates>=5&&t===this.lastRecordedTime){this.consecutiveUpdates++;this.waiting_()}else if(t===this.lastRecordedTime){this.consecutiveUpdates++}else{this.consecutiveUpdates=0;this.lastRecordedTime=t}}},{key:"cancelTimer_",value:function e(){this.consecutiveUpdates=0;if(this.timer_){this.logger_("cancelTimer_");clearTimeout(this.timer_)}this.timer_=null}},{key:"waiting_",value:function e(){var t=this.seekable();var i=this.tech_.currentTime();if(this.tech_.seeking()||this.timer_!==null){return}if(this.fellOutOfLiveWindow_(t,i)){var r=t.end(t.length-1);this.logger_("Fell out of live window at time "+i+". Seeking to "+("live point (seekable end) "+r));this.cancelTimer_();this.tech_.setCurrentTime(r);this.tech_.trigger("liveresync");return}var n=this.tech_.buffered();var a=u["default"].findNextRange(n,i);if(this.videoUnderflow_(a,n,i)){this.cancelTimer_();this.tech_.setCurrentTime(i);this.tech_.trigger("videounderflow");return}if(a.length>0){var s=a.start(0)-i;this.logger_("Stopped at "+i+", setting timer for "+s+", seeking "+("to "+a.start(0)));this.timer_=setTimeout(this.skipTheGap_.bind(this),s*1e3,i)}}},{key:"fellOutOfLiveWindow_",value:function e(t,i){if(t.length&&t.start(0)>0&&i<t.start(0)){return true}return false}},{key:"videoUnderflow_",value:function e(t,i,r){if(t.length===0){var n=this.gapFromVideoUnderflow_(i,r);if(n){this.logger_("Encountered a gap in video from "+n.start+" to "+n.end+". "+("Seeking to current time "+r));return true}}return false}},{key:"skipTheGap_",value:function e(t){var i=this.tech_.buffered();var r=this.tech_.currentTime();var n=u["default"].findNextRange(i,r);this.cancelTimer_();if(n.length===0||r!==t){return}this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",t,"nextRange start:",n.start(0));this.tech_.setCurrentTime(n.start(0)+u["default"].TIME_FUDGE_FACTOR)}},{key:"gapFromVideoUnderflow_",value:function e(t,i){var r=u["default"].findGaps(t);for(var n=0;n<r.length;n++){var a=r.start(n);var s=r.end(n);if(i-a<4&&i-a>2){return{start:a,end:s}}}return null}},{key:"logger_",value:function e(){}}]);return e}();i["default"]=c;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./ranges":9}],7:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});function n(e){return e&&e.__esModule?e:{default:e}}var a=e("./resolve-url");var s=n(a);var o=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var u=e("./playlist.js");var f=e("./stream");var d=n(f);var l=e("m3u8-parser");var c=n(l);var h=e("global/window");var p=n(h);var m=function e(t,i,r){var n=i.slice();var a=undefined;var s=undefined;r=r||0;a=Math.min(t.length,i.length+r);for(s=r;s<a;s++){n[s-r]=(0,o.mergeOptions)(t[s],n[s-r])}return n};var v=function e(t,i){var r=false;var n=(0,o.mergeOptions)(t,{});var a=t.playlists.length;var u=undefined;var f=undefined;var d=undefined;while(a--){u=n.playlists[a];if(u.uri===i.uri){if(u.segments&&i.segments&&u.segments.length===i.segments.length&&u.mediaSequence===i.mediaSequence){continue}n.playlists[a]=(0,o.mergeOptions)(u,i);n.playlists[i.uri]=n.playlists[a];if(u.segments){n.playlists[a].segments=m(u.segments,i.segments,i.mediaSequence-u.mediaSequence)}d=0;if(n.playlists[a].segments){d=n.playlists[a].segments.length}while(d--){f=n.playlists[a].segments[d];if(!f.resolvedUri){f.resolvedUri=(0,s["default"])(u.resolvedUri,f.uri)}if(f.key&&!f.key.resolvedUri){f.key.resolvedUri=(0,s["default"])(u.resolvedUri,f.key.uri)}if(f.map&&!f.map.resolvedUri){f.map.resolvedUri=(0,s["default"])(u.resolvedUri,f.map.uri)}}r=true}}return r?n:null};var y=function e(t,i,r){var n=this;var a=this;var o=undefined;var f=undefined;var d=undefined;var l=undefined;var h=undefined;e.prototype.constructor.call(this);this.hls_=i;if(!t){throw new Error("A non-empty playlist URL is required")}l=function(e,t,i){a.setBandwidth(d||e);d=null;if(i){a.state=i}a.error={playlist:a.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t,responseText:e.responseText,code:e.status>=500?4:2};a.trigger("error")};h=function(e,t){var i=undefined;var r=undefined;var n=undefined;a.setBandwidth(d||e);d=null;a.state="HAVE_METADATA";i=new c["default"].Parser;i.push(e.responseText);i.end();i.manifest.uri=t;n=v(a.master,i.manifest);r=(i.manifest.targetDuration||10)*1e3;a.targetDuration=i.manifest.targetDuration;if(n){a.master=n;a.media_=a.master.playlists[i.manifest.uri]}else{r/=2}if(!a.media().endList){p["default"].clearTimeout(f);f=p["default"].setTimeout(function(){a.trigger("mediaupdatetimeout")},r)}a.trigger("loadedplaylist")};a.state="HAVE_NOTHING";o=this.dispose;a.dispose=function(){a.stopRequest();p["default"].clearTimeout(f);o.call(this)};a.stopRequest=function(){if(d){var e=d;d=null;e.onreadystatechange=null;e.abort()}};a.enabledPlaylists_=function(){return a.master.playlists.filter(u.isEnabled).length};a.isLowestEnabledRendition_=function(){var e=a.media();if(!e||!e.attributes){return false}var t=a.media().attributes.BANDWIDTH||0;return!(a.master.playlists.filter(function(e){var i=(0,u.isEnabled)(e);if(!i){return false}var r=0;if(e&&e.attributes){r=e.attributes.BANDWIDTH}return r<=t}).length>1)};a.media=function(e){var t=a.state;var i=undefined;if(!e){return a.media_}if(a.state==="HAVE_NOTHING"){throw new Error("Cannot switch media playlist from "+a.state)}if(typeof e==="string"){if(!a.master.playlists[e]){throw new Error("Unknown playlist URI: "+e)}e=a.master.playlists[e]}i=!a.media_||e.uri!==a.media_.uri;if(a.master.playlists[e.uri].endList){if(d){d.onreadystatechange=null;d.abort();d=null}a.state="HAVE_METADATA";a.media_=e;if(i){a.trigger("mediachanging");a.trigger("mediachange")}return}if(!i){return}a.state="SWITCHING_MEDIA";if(d){if((0,s["default"])(a.master.uri,e.uri)===d.url){return}d.onreadystatechange=null;d.abort();d=null}if(this.media_){this.trigger("mediachanging")}d=this.hls_.xhr({uri:(0,s["default"])(a.master.uri,e.uri),withCredentials:r},function(i,r){if(!d){return}if(i){return l(d,e.uri,t)}h(r,e.uri);if(t==="HAVE_MASTER"){a.trigger("loadedmetadata")}else{a.trigger("mediachange")}})};a.setBandwidth=function(e){a.bandwidth=e.bandwidth};a.on("mediaupdatetimeout",function(){if(a.state!=="HAVE_METADATA"){return}a.state="HAVE_CURRENT_METADATA";d=this.hls_.xhr({uri:(0,s["default"])(a.master.uri,a.media().uri),withCredentials:r},function(e,t){if(!d){return}if(e){return l(d,a.media().uri)}h(d,a.media().uri)})});a.on("firstplay",function(){var e=a.media();if(e){e.syncInfo={mediaSequence:e.mediaSequence,time:0}}});a.pause=function(){a.stopRequest();p["default"].clearTimeout(f)};a.load=function(){if(a.started){if(!a.media().endList){a.trigger("mediaupdatetimeout")}else{a.trigger("loadedplaylist")}}else{a.start()}};a.start=function(){a.started=true;d=n.hls_.xhr({uri:t,withCredentials:r},function(e,i){var r=undefined;var n=undefined;var o=undefined;if(!d){return}d=null;if(e){a.error={status:i.status,message:"HLS playlist request error at URL: "+t,responseText:i.responseText,code:2};return a.trigger("error")}r=new c["default"].Parser;r.push(i.responseText);r.end();a.state="HAVE_MASTER";r.manifest.uri=t;if(r.manifest.playlists){a.master=r.manifest;o=a.master.playlists.length;while(o--){n=a.master.playlists[o];a.master.playlists[n.uri]=n;n.resolvedUri=(0,s["default"])(a.master.uri,n.uri)}for(var u in a.master.mediaGroups.AUDIO){for(var f in a.master.mediaGroups.AUDIO[u]){var l=a.master.mediaGroups.AUDIO[u][f];if(l.uri){l.resolvedUri=(0,s["default"])(a.master.uri,l.uri)}}}a.trigger("loadedplaylist");if(!d){a.media(r.manifest.playlists[0])}return}a.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:p["default"].location.href,playlists:[{uri:t}]};a.master.playlists[t]=a.master.playlists[0];a.master.playlists[0].resolvedUri=t;h(i,t);return a.trigger("loadedmetadata")})}};y.prototype=new d["default"];i["default"]=y;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./playlist.js":8,"./resolve-url":12,"./stream":15,"global/window":28,"m3u8-parser":29}],8:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=typeof window!=="undefined"?window["videojs"]:typeof t!=="undefined"?t["videojs"]:null;var a=e("global/window");var s=r(a);var o={UNSAFE_LIVE_SEGMENTS:3};var u=function e(t,i){var r=0;var n=i-t.mediaSequence;var a=t.segments[n];if(a){if(typeof a.start!=="undefined"){return{result:a.start,precise:true}}if(typeof a.end!=="undefined"){return{result:a.end-a.duration,precise:true}}}while(n--){a=t.segments[n];if(typeof a.end!=="undefined"){return{result:r+a.end,precise:true}}r+=a.duration;if(typeof a.start!=="undefined"){return{result:r+a.start,precise:true}}}return{result:r,precise:false}};var f=function e(t,i){var r=0;var n=undefined;var a=i-t.mediaSequence;for(;a<t.segments.length;a++){n=t.segments[a];if(typeof n.start!=="undefined"){return{result:n.start-r,precise:true}}r+=n.duration;if(typeof n.end!=="undefined"){return{result:n.end-r,precise:true}}}return{result:-1,precise:false}};var d=function e(t,i,r){var n=undefined;var a=undefined;if(typeof i==="undefined"){i=t.mediaSequence+t.segments.length}if(i<t.mediaSequence){return 0}n=u(t,i);if(n.precise){return n.result}a=f(t,i);if(a.precise){return a.result}return n.result+r};var l=function e(t,i,r){if(!t){return 0}if(typeof r!=="number"){r=0}if(typeof i==="undefined"){if(t.totalDuration){return t.totalDuration}if(!t.endList){return s["default"].Infinity}}return d(t,i,r)};i.duration=l;var c=function e(t,i,r){var n=0;if(i>r){var a=[r,i];i=a[0];r=a[1]}if(i<0){for(var s=i;s<Math.min(0,r);s++){n+=t.targetDuration}i=0}for(var s=i;s<r;s++){n+=t.segments[s].duration}return n};i.sumDurations=c;var h=function e(t){if(!t||!t.segments){return[null,null]}var i=t.syncInfo||null;var r=null;for(var n=0,a=t.segments.length;n<a;n++){var s=t.segments[n];if(typeof s.start!=="undefined"){r={mediaSequence:t.mediaSequence+n,time:s.start};break}}return{expiredSync:i,segmentSync:r}};var p=function e(t,i,r){if(i&&r){var n=i.mediaSequence-t.mediaSequence;var a=r.mediaSequence-t.mediaSequence;var s=undefined;var o=undefined;if(Math.abs(n)>Math.abs(a)){s=a;o=-r.time}else{s=n;o=i.time}return Math.abs(o+c(t,s,0))}if(i){var s=i.mediaSequence-t.mediaSequence;return i.time+c(t,s,0)}if(r){var s=r.mediaSequence-t.mediaSequence;return r.time-c(t,s,0)}};var m=function e(t){if(!t||!t.segments){return(0,n.createTimeRange)()}if(t.endList){return(0,n.createTimeRange)(0,l(t))}var i=h(t);var r=i.expiredSync;var a=i.segmentSync;if(!r&&!a){return(0,n.createTimeRange)()}var s=p(t,r,a);var u=s;var f=Math.max(0,t.segments.length-o.UNSAFE_LIVE_SEGMENTS);var c=d(t,t.mediaSequence+f,s);return(0,n.createTimeRange)(u,c)};i.seekable=m;var v=function e(t){return t-Math.floor(t)===0};var y=function e(t,i){if(v(i)){return i+t*.1}var r=i.toString().split(".")[1].length;for(var n=1;n<=r;n++){var a=Math.pow(10,n);var s=i*a;if(v(s)||n===r){return(s+t)/a}}};var g=y.bind(null,1);var b=y.bind(null,-1);var _=function e(t,i,r,n){var a=undefined;var s=undefined;var o=t.segments.length;var u=i-n;if(u<0){if(r>0){for(a=r-1;a>=0;a--){s=t.segments[a];u+=b(s.duration);if(u>0){return{mediaIndex:a,startTime:n-c(t,r,a)}}}}return{mediaIndex:0,startTime:i}}if(r<0){for(a=r;a<0;a++){u-=t.targetDuration;if(u<0){return{mediaIndex:0,startTime:i}}}r=0}for(a=r;a<o;a++){s=t.segments[a];u-=g(s.duration);if(u<0){return{mediaIndex:a,startTime:n+c(t,r,a)}}}return{mediaIndex:o-1,startTime:i}};i.getMediaInfoForTime_=_;var T=function e(t){return t.excludeUntil&&t.excludeUntil>Date.now()};i.isBlacklisted=T;var w=function e(t){var i=T(t);return!t.disabled&&!i};i.isEnabled=w;o.duration=l;o.seekable=m;o.getMediaInfoForTime_=_;o.isEnabled=w;o.isBlacklisted=T;i["default"]=o}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"global/window":28}],9:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){var i=[];var r=true;var n=false;var a=undefined;try{for(var s=e[Symbol.iterator](),o;!(r=(o=s.next()).done);r=true){i.push(o.value);if(t&&i.length===t)break}}catch(e){n=true;a=e}finally{try{if(!r&&s["return"])s["return"]()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return e(t,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();function n(e){return e&&e.__esModule?e:{default:e}}var a=typeof window!=="undefined"?window["videojs"]:typeof e!=="undefined"?e["videojs"]:null;var s=n(a);var o=1/30;var u=function e(t,i){var n=r(i,2);var a=n[0];var s=n[1];return Math.min(Math.max(a,t),s)};var f=function e(t,i){var r=[];var n=undefined;if(t&&t.length){for(n=0;n<t.length;n++){if(i(t.start(n),t.end(n))){r.push([t.start(n),t.end(n)])}}}return s["default"].createTimeRanges(r)};var d=function e(t,i){return f(t,function(e,t){return e-o<=i&&t+o>=i})};var l=function e(t,i){return f(t,function(e){return e-o>=i})};var c=function e(t){if(t.length<2){return s["default"].createTimeRanges()}var i=[];for(var r=1;r<t.length;r++){var n=t.end(r-1);var a=t.start(r);i.push([n,a])}return s["default"].createTimeRanges(i)};var h=function e(t,i){var r=undefined;var n=undefined;var a=undefined;var s=[];var o=[];var u=function e(t){return t[0]<=a&&t[1]>=a};if(t){for(r=0;r<t.length;r++){n=t.start(r);a=t.end(r);o.push([n,a])}}if(i){for(r=0;r<i.length;r++){n=i.start(r);a=i.end(r);if(o.some(u)){continue}s.push(a)}}if(s.length!==1){return null}return s[0]};var p=function e(t,i){var r=null;var n=null;var a=0;var o=[];var u=[];if(!t||!t.length||!i||!i.length){return s["default"].createTimeRange()}var f=t.length;while(f--){o.push({time:t.start(f),type:"start"});o.push({time:t.end(f),type:"end"})}f=i.length;while(f--){o.push({time:i.start(f),type:"start"});o.push({time:i.end(f),type:"end"})}o.sort(function(e,t){return e.time-t.time});for(f=0;f<o.length;f++){if(o[f].type==="start"){a++;if(a===2){r=o[f].time}}else if(o[f].type==="end"){a--;if(a===1){n=o[f].time}}if(r!==null&&n!==null){u.push([r,n]);r=null;n=null}}return s["default"].createTimeRanges(u)};var m=function e(t,i,r,n){var a=i.end(0)-i.start(0);var s=t.end(0)-t.start(0);var o=a-s;var u=p(t,n);var f=p(i,n);var d=0;var l=0;var c=u.length;while(c--){d+=u.end(c)-u.start(c);if(u.start(c)===r){d+=o}}c=f.length;while(c--){l+=f.end(c)-f.start(c)}return Math.max(d,l)/a*100};var v=function e(t,i,r,n){var a=t+i;var o=s["default"].createTimeRanges([[t,a]]);var f=s["default"].createTimeRanges([[u(t,[r,a]),a]]);if(f.start(0)===f.end(0)){return 0}var d=m(f,o,r,n);if(isNaN(d)||d===Infinity||d===-Infinity){return 0}return d};i["default"]={findRange:d,findNextRange:l,findGaps:c,findSoleUncommonTimeRangesEnd:h,getSegmentBufferedPercent:v,TIME_FUDGE_FACTOR:o};t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],10:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=typeof window!=="undefined"?window["videojs"]:typeof e!=="undefined"?e["videojs"]:null;var a=r(n);var s={errorInterval:30,getSource:function e(t){var i=this.tech({IWillNotUseThisInPlugins:true});var r=i.currentSource_;return t(r)}};var o=function e(t,i){var r=0;var n=0;var o=a["default"].mergeOptions(s,i);var u=function e(){if(n){t.currentTime(n)}};var f=function e(i){if(i===null||i===undefined){return}n=t.duration()!==Infinity&&t.currentTime()||0;t.one("loadedmetadata",u);t.src(i);t.play()};var d=function e(){if(Date.now()-r<o.errorInterval*1e3){return}if(!o.getSource||typeof o.getSource!=="function"){a["default"].log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}r=Date.now();return o.getSource.call(t,f)};var l=function e(){t.off("loadedmetadata",u);t.off("error",d);t.off("dispose",e)};var c=function i(r){l();e(t,r)};t.on("error",d);t.on("dispose",l);t.reloadSourceOnError=c};var u=function e(t){o(this,t)};i["default"]=u;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var n=e("./playlist.js");var a=function e(t,i,r,a){var s=t.master.playlists[i];var o=(0,n.isBlacklisted)(s);var u=(0,n.isEnabled)(s);if(typeof a==="undefined"){return u}if(a){delete s.disabled}else{s.disabled=true}if(a!==u&&!o){r()}return a};var s=function e(t,i,n){r(this,e);var s=t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_);if(i.attributes){var o=i.attributes;if(o.RESOLUTION){var u=o.RESOLUTION;this.width=u.width;this.height=u.height}this.bandwidth=o.BANDWIDTH}this.id=n;this.enabled=a.bind(this,t.playlists,i.uri,s)};var o=function e(t){var i=t.playlists;t.representations=function(){return i.master.playlists.filter(function(e){return!(0,n.isBlacklisted)(e)}).map(function(e,i){return new s(t,e,e.uri)})}};i["default"]=o;t.exports=i["default"]},{"./playlist.js":8}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=e("url-toolkit");var a=r(n);var s=e("global/window");var o=r(s);var u=function e(t,i){if(/^[a-z]+:/i.test(i)){return i}if(!/\/\//i.test(t)){t=a["default"].buildAbsoluteURL(o["default"].location.href,t)}return a["default"].buildAbsoluteURL(t,i)};i["default"]=u;t.exports=i["default"]},{"global/window":28,"url-toolkit":41}],13:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var f=e("./playlist");var d=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var l=s(d);var c=e("./source-updater");var h=s(c);var p=e("./config");var m=s(p);var v=e("global/window");var y=s(v);var g=e("./bin-utils");var b=500;var _="console";var T=function e(){if(y["default"].logit){y["default"][_].log.apply(y["default"][_],arguments)}};var w=function e(t,i,r){if(!t){return false}var n=t.segments;var a=r===n.length;return t.endList&&i.readyState==="open"&&a};var S=function e(t){var i=undefined;var r=undefined;r=t.offset+t.length-1;i=t.offset;return"bytes="+i+"-"+r};var k=function e(t){var i={};if("byterange"in t){i.Range=S(t.byterange)}return i};var O=function e(t){var i=t.byterange||{length:Infinity,offset:0};return[i.length,i.offset,t.resolvedUri].join(",")};var P=function(e){u(t,e);function t(e){var i=this;o(this,t);a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var r=undefined;if(!e){throw new TypeError("Initialization options are required")}if(typeof e.currentTime!=="function"){throw new TypeError("No currentTime getter specified")}if(!e.mediaSource){throw new TypeError("No MediaSource specified")}r=l["default"].mergeOptions(l["default"].options.hls,e);this.state="INIT";this.bandwidth=r.bandwidth;this.throughput={rate:0,count:0};this.roundTrip=NaN;this.resetStats_();this.mediaIndex=null;this.hasPlayed_=r.hasPlayed;this.currentTime_=r.currentTime;this.seekable_=r.seekable;this.seeking_=r.seeking;this.setCurrentTime_=r.setCurrentTime;this.mediaSource_=r.mediaSource;this.hls_=r.hls;this.loaderType_=r.loaderType;this.checkBufferTimeout_=null;this.error_=void 0;this.currentTimeline_=-1;this.xhr_=null;this.pendingSegment_=null;this.mimeType_=null;this.sourceUpdater_=null;this.xhrOptions_=null;this.activeInitSegmentId_=null;this.initSegments_={};this.decrypter_=r.decrypter;this.syncController_=r.syncController;this.syncPoint_={segmentIndex:0,time:0};this.syncController_.on("syncinfoupdate",function(){return i.trigger("syncinfoupdate")});this.fetchAtBuffer_=false}n(t,[{key:"resetStats_",value:function e(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0}},{key:"dispose",value:function e(){this.state="DISPOSED";this.abort_();if(this.sourceUpdater_){this.sourceUpdater_.dispose()}this.resetStats_()}},{key:"abort",value:function e(){if(this.state!=="WAITING"){if(this.pendingSegment_){this.pendingSegment_=null}return}this.abort_();if(!this.paused()){this.state="READY";this.monitorBuffer_()}}},{key:"error",value:function e(t){if(typeof t!=="undefined"){this.error_=t}this.pendingSegment_=null;return this.error_}},{key:"load",value:function e(){this.monitorBuffer_();if(!this.playlist_){return}this.syncController_.setDateTimeMapping(this.playlist_);if(this.state==="INIT"&&this.mimeType_){return this.init_()}if(!this.sourceUpdater_||this.state!=="READY"&&this.state!=="INIT"){return}this.state="READY"}},{key:"playlist",value:function e(t){var i=arguments.length<=1||arguments[1]===undefined?{}:arguments[1];if(!t){return}var r=this.playlist_;var n=this.pendingSegment_;this.playlist_=t;this.xhrOptions_=i;if(!this.hasPlayed_()){t.syncInfo={mediaSequence:t.mediaSequence,time:0};this.trigger("syncinfoupdate")}if(this.mimeType_&&this.state==="INIT"&&!this.paused()){return this.init_()}if(!r||r.uri!==t.uri){if(this.mediaIndex!==null){this.resyncLoader()}return}var a=t.mediaSequence-r.mediaSequence;T("mediaSequenceDiff",a);if(this.mediaIndex!==null){this.mediaIndex-=a}if(n){n.mediaIndex-=a;if(n.mediaIndex>=0){n.segment=t.segments[n.mediaIndex]}}this.syncController_.saveExpiredSegmentInfo(r,t)}},{key:"pause",value:function e(){if(this.checkBufferTimeout_){y["default"].clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=null}}},{key:"paused",value:function e(){return this.checkBufferTimeout_===null}},{key:"mimeType",value:function e(t){if(this.mimeType_){return}this.mimeType_=t;if(this.playlist_&&this.state==="INIT"&&!this.paused()){this.init_()}}},{key:"monitorBuffer_",value:function e(){if(this.checkBufferTimeout_){y["default"].clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=y["default"].setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function e(){if(this.state==="READY"){this.fillBuffer_()}if(this.checkBufferTimeout_){y["default"].clearTimeout(this.checkBufferTimeout_)}this.checkBufferTimeout_=y["default"].setTimeout(this.monitorBufferTick_.bind(this),b)}},{key:"getSyncSegmentCandidate_",value:function e(t){var i=this;if(this.currentTimeline_===-1){return 0}var r=t.segments.map(function(e,t){return{timeline:e.timeline,segmentIndex:t}}).filter(function(e){return e.timeline===i.currentTimeline_});if(r.length){return r[Math.min(r.length-1,1)].segmentIndex}return Math.max(t.segments.length-1,0)}},{key:"checkBuffer_",value:function e(t,i,r,n,a,s){var o=0;var u=undefined;if(t.length){o=t.end(t.length-1)}var d=Math.max(0,o-a);if(!i.segments.length){return null}T("cB_","mediaIndex:",r,"hasPlayed:",n,"currentTime:",a,"syncPoint:",s,"fetchAtBuffer:",this.fetchAtBuffer_);T("cB_ 2","bufferedTime:",d);if(d>=m["default"].GOAL_BUFFER_LENGTH){return null}if(!n&&d>=1){return null}if(s===null){r=this.getSyncSegmentCandidate_(i);T("getSync",r);return this.generateSegmentInfo_(i,r,null,true)}if(r!==null){T("++",r+1);var l=i.segments[r];if(l&&l.end){u=l.end}else{u=o}return this.generateSegmentInfo_(i,r+1,u,false)}if(this.fetchAtBuffer_){var c=(0,f.getMediaInfoForTime_)(i,o,s.segmentIndex,s.time);r=c.mediaIndex;u=c.startTime}else{var c=(0,f.getMediaInfoForTime_)(i,a,s.segmentIndex,s.time);r=c.mediaIndex;u=c.startTime}T("gMIFT",r,"sos",u);return this.generateSegmentInfo_(i,r,u,false)}},{key:"generateSegmentInfo_",value:function e(t,i,r,n){if(i<0||i>=t.segments.length){return null}var a=t.segments[i];return{uri:a.resolvedUri,mediaIndex:i,isSyncRequest:n,startOfSegment:r,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:a.timeline,duration:a.duration,segment:a}}},{key:"abort_",value:function e(){if(this.xhr_){this.xhr_.abort()}this.pendingSegment_=null}},{key:"init_",value:function e(){this.state="READY";this.sourceUpdater_=new h["default"](this.mediaSource_,this.mimeType_);this.resetEverything();return this.monitorBuffer_()}},{key:"fillBuffer_",value:function e(){if(this.sourceUpdater_.updating()){return}if(!this.syncPoint_){this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.mediaSource_.duration,this.currentTimeline_)}var t=this.checkBuffer_(this.sourceUpdater_.buffered(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(!t){return}var i=w(this.playlist_,this.mediaSource_,t.mediaIndex);if(i){this.mediaSource_.endOfStream();return}if(t.mediaIndex===this.playlist_.segments.length-1&&this.mediaSource_.readyState==="ended"&&!this.seeking_()){return}if(t.timeline!==this.currentTimeline_||t.startOfSegment!==null&&t.startOfSegment<this.sourceUpdater_.timestampOffset()){this.syncController_.reset();t.timestampOffset=t.startOfSegment}this.currentTimeline_=t.timeline;this.loadSegment_(t)}},{key:"trimBuffer_",value:function e(t){var i=this.seekable_();var r=this.currentTime_();var n=undefined;if(i.length&&i.start(0)>0&&i.start(0)<r){return i.start(0)}n=r-60;return n}},{key:"loadSegment_",value:function e(t){var i=this;var r=undefined;var n=undefined;var a=undefined;var s=undefined;var o=0;o=this.trimBuffer_(t);if(o>0){this.sourceUpdater_.remove(0,o)}r=t.segment;if(r.key){var u=l["default"].mergeOptions(this.xhrOptions_,{uri:r.key.resolvedUri,responseType:"arraybuffer"});n=this.hls_.xhr(u,this.handleResponse_.bind(this))}if(r.map&&!this.initSegments_[O(r.map)]){var f=l["default"].mergeOptions(this.xhrOptions_,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:k(r.map)});a=this.hls_.xhr(f,this.handleResponse_.bind(this))}this.pendingSegment_=t;var d=l["default"].mergeOptions(this.xhrOptions_,{uri:t.uri,responseType:"arraybuffer",headers:k(r)});s=this.hls_.xhr(d,this.handleResponse_.bind(this));s.addEventListener("progress",function(e){i.trigger(e)});this.xhr_={keyXhr:n,initSegmentXhr:a,segmentXhr:s,abort:function e(){if(this.segmentXhr){this.segmentXhr.onreadystatechange=null;this.segmentXhr.abort();this.segmentXhr=null}if(this.initSegmentXhr){this.initSegmentXhr.onreadystatechange=null;this.initSegmentXhr.abort();this.initSegmentXhr=null}if(this.keyXhr){this.keyXhr.onreadystatechange=null;this.keyXhr.abort();this.keyXhr=null}}};this.state="WAITING"}},{key:"handleResponse_",value:function e(t,i){var r=undefined;var n=undefined;var a=undefined;if(!this.xhr_||i!==this.xhr_.segmentXhr&&i!==this.xhr_.keyXhr&&i!==this.xhr_.initSegmentXhr){return}r=this.pendingSegment_;n=r.segment;if(i.timedout){this.abort_();this.bandwidth=1;this.roundTrip=NaN;this.state="READY";return this.trigger("progress")}if(!i.aborted&&t){var s=this.xhr_.keyXhr;this.abort_();this.error({status:i.status,message:i===s?"HLS key request error at URL: "+n.key.uri:"HLS segment request error at URL: "+r.uri,code:2,xhr:i});this.state="READY";this.pause();return this.trigger("error")}if(!i.response){this.abort_();return}if(i===this.xhr_.segmentXhr){this.xhr_.segmentXhr=null;r.startOfAppend=Date.now();this.roundTrip=i.roundTripTime;this.bandwidth=i.bandwidth;this.mediaBytesTransferred+=i.bytesReceived||0;this.mediaRequests+=1;this.mediaTransferDuration+=i.roundTripTime||0;if(n.key){r.encryptedBytes=new Uint8Array(i.response)}else{r.bytes=new Uint8Array(i.response)}}if(i===this.xhr_.keyXhr){this.xhr_.keyXhr=null;if(i.response.byteLength!==16){this.abort_();this.error({status:i.status,message:"Invalid HLS key at URL: "+n.key.uri,code:2,xhr:i});this.state="READY";this.pause();return this.trigger("error")}a=new DataView(i.response);n.key.bytes=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]);n.key.iv=n.key.iv||new Uint32Array([0,0,0,r.mediaIndex+r.playlist.mediaSequence])}if(i===this.xhr_.initSegmentXhr){this.xhr_.initSegmentXhr=null;n.map.bytes=new Uint8Array(i.response);this.initSegments_[O(n.map)]=n.map}if(!this.xhr_.segmentXhr&&!this.xhr_.keyXhr&&!this.xhr_.initSegmentXhr){this.xhr_=null;this.processResponse_()}}},{key:"resetEverything",value:function e(){this.resetLoader();this.remove(0,Infinity)}},{key:"resetLoader",value:function e(){this.fetchAtBuffer_=false;this.resyncLoader()}},{key:"resyncLoader",value:function e(){this.mediaIndex=null;this.syncPoint_=null}},{key:"remove",value:function e(t,i){if(this.sourceUpdater_){this.sourceUpdater_.remove(t,i)}}},{key:"processResponse_",value:function e(){if(!this.pendingSegment_){this.state="READY";return}this.state="DECRYPTING";var t=this.pendingSegment_;var i=t.segment;if(i.key){this.decrypter_.postMessage((0,g.createTransferableMessage)({source:this.loaderType_,encrypted:t.encryptedBytes,key:i.key.bytes,iv:i.key.iv}),[t.encryptedBytes.buffer,i.key.bytes.buffer])}else{this.handleSegment_()}}},{key:"handleDecrypted_",value:function e(t){var i=this.pendingSegment_;var r=t.decrypted;if(i){i.bytes=new Uint8Array(r.bytes,r.byteOffset,r.byteLength)}this.handleSegment_()}},{key:"handleSegment_",value:function e(){var t=this;if(!this.pendingSegment_){this.state="READY";return}this.state="APPENDING";var i=this.pendingSegment_;var r=i.segment;this.syncController_.probeSegmentInfo(i);if(i.isSyncRequest){this.pendingSegment_=null;this.state="READY";return}if(i.timestampOffset!==null&&i.timestampOffset!==this.sourceUpdater_.timestampOffset()){this.sourceUpdater_.timestampOffset(i.timestampOffset)}if(r.map){(function(){var e=O(r.map);if(!t.activeInitSegmentId_||t.activeInitSegmentId_!==e){var i=t.initSegments_[e];t.sourceUpdater_.appendBuffer(i.bytes,function(){t.activeInitSegmentId_=e})}})()}i.byteLength=i.bytes.byteLength;if(typeof r.start==="number"&&typeof r.end==="number"){this.mediaSecondsLoaded+=r.end-r.start}else{this.mediaSecondsLoaded+=r.duration}this.sourceUpdater_.appendBuffer(i.bytes,this.handleUpdateEnd_.bind(this))}},{key:"handleUpdateEnd_",value:function e(){if(!this.pendingSegment_){this.state="READY";if(!this.paused()){this.monitorBuffer_()}return}var t=this.pendingSegment_;this.pendingSegment_=null;this.recordThroughput_(t);this.mediaIndex=t.mediaIndex;this.fetchAtBuffer_=true;T("handleUpdateEnd_",this.mediaIndex);var i=w(t.playlist,this.mediaSource_,this.mediaIndex+1);if(i){this.mediaSource_.endOfStream()}this.state="READY";this.trigger("progress");if(!this.paused()){this.monitorBuffer_()}}},{key:"recordThroughput_",value:function e(t){var i=this.throughput.rate;var r=Date.now()-t.startOfAppend+1;var n=Math.floor(t.byteLength/r*8*1e3);this.throughput.rate+=(n-i)/++this.throughput.count}}]);return t}(l["default"].EventTarget);i["default"]=P;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./bin-utils":2,"./config":3,"./playlist":8,"./source-updater":14,"global/window":28}],14:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var s=typeof window!=="undefined"?window["videojs"]:typeof e!=="undefined"?e["videojs"]:null;var o=n(s);var u=function(){function e(t,i){var r=this;a(this,e);var n=function e(){r.sourceBuffer_=t.addSourceBuffer(i);r.onUpdateendCallback_=function(){var e=r.pendingCallback_;r.pendingCallback_=null;if(e){e()}r.runCallback_()};r.sourceBuffer_.addEventListener("updateend",r.onUpdateendCallback_);r.runCallback_()};this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=t;if(t.readyState==="closed"){t.addEventListener("sourceopen",n)}else{n()}}r(e,[{key:"abort",value:function e(t){var i=this;this.queueCallback_(function(){i.sourceBuffer_.abort()},t)}},{key:"appendBuffer",value:function e(t,i){var r=this;this.queueCallback_(function(){r.sourceBuffer_.appendBuffer(t)},i)}},{key:"buffered",value:function e(){if(!this.sourceBuffer_){return o["default"].createTimeRanges()}return this.sourceBuffer_.buffered}},{key:"duration",value:function e(t){var i=this;this.queueCallback_(function(){i.sourceBuffer_.duration=t})}},{key:"remove",value:function e(t,i){var r=this;this.queueCallback_(function(){r.sourceBuffer_.remove(t,i)})}},{key:"updating",value:function e(){return!this.sourceBuffer_||this.sourceBuffer_.updating}},{key:"timestampOffset",value:function e(t){var i=this;if(typeof t!=="undefined"){this.queueCallback_(function(){i.sourceBuffer_.timestampOffset=t});this.timestampOffset_=t}return this.timestampOffset_}},{key:"queueCallback_",value:function e(t,i){this.callbacks_.push([t.bind(this),i]);this.runCallback_()}},{key:"runCallback_",value:function e(){var t=undefined;if(this.sourceBuffer_&&!this.sourceBuffer_.updating&&this.callbacks_.length){t=this.callbacks_.shift();this.pendingCallback_=t[1];t[0]()}}},{key:"dispose",value:function e(){this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);if(this.sourceBuffer_&&this.mediaSource.readyState==="open"){this.sourceBuffer_.abort()}}}]);return e}();i["default"]=u;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var a=function(){function e(){n(this,e);this.listeners={}}r(e,[{key:"on",value:function e(t,i){if(!this.listeners[t]){this.listeners[t]=[]}this.listeners[t].push(i)}},{key:"off",value:function e(t,i){var r=undefined;if(!this.listeners[t]){return false}r=this.listeners[t].indexOf(i);this.listeners[t].splice(r,1);return r>-1}},{key:"trigger",value:function e(t){var i=undefined;var r=undefined;var n=undefined;var a=undefined;i=this.listeners[t];if(!i){return}if(arguments.length===2){n=i.length;for(r=0;r<n;++r){i[r].call(this,arguments[1])}}else{a=Array.prototype.slice.call(arguments,1);n=i.length;for(r=0;r<n;++r){i[r].apply(this,a)}}}},{key:"dispose",value:function e(){this.listeners={}}},{key:"pipe",value:function e(t){this.on("data",function(e){t.push(e)})}}]);return e}();i["default"]=a;t.exports=i["default"]},{}],16:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var n=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function o(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var u=e("mux.js/lib/mp4/probe");var f=a(u);var d=e("mux.js/lib/tools/ts-inspector.js");var l=e("./playlist");var c=typeof window!=="undefined"?window["videojs"]:typeof t!=="undefined"?t["videojs"]:null;var h=a(c);var p="console";var m=function e(){if(window.logit){window[p].log.apply(window[p],arguments)}};var v=[{name:"VOD",run:function e(t,i,r,n){if(r!==Infinity){var a={time:0,segmentIndex:0};return a}return null}},{name:"ProgramDateTime",run:function e(t,i,r,n){if(t.datetimeToDisplayTime&&i.dateTimeObject){var a=i.dateTimeObject.getTime()/1e3;var s=a+t.datetimeToDisplayTime;var o={time:s,segmentIndex:0};return o}return null}},{name:"Segment",run:function e(t,i,r,n){var a=i.segments;for(var s=a.length-1;s>=0;s--){var o=a[s];if(o.timeline===n&&typeof o.start!=="undefined"){var u={time:o.start,segmentIndex:s};return u}}return null}},{name:"Discontinuity",run:function e(t,i,r,n){if(i.discontinuityStarts.length){for(var a=0;a<i.discontinuityStarts.length;a++){var s=i.discontinuityStarts[a];var o=i.discontinuitySequence+a+1;if(t.discontinuities[o]){var u={time:t.discontinuities[o].time,segmentIndex:s};return u}}}return null}},{name:"Playlist",run:function e(t,i,r,n){if(i.syncInfo){var a={time:i.syncInfo.time,segmentIndex:i.syncInfo.mediaSequence-i.mediaSequence};return a}return null}}];i.syncPointStrategies=v;var y=function(e){o(t,e);function t(){s(this,t);n(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);this.inspectCache_=undefined;this.timelines=[];this.discontinuities=[];this.datetimeToDisplayTime=null}r(t,[{key:"getSyncPoint",value:function e(t,i,r){for(var n=0;n<v.length;n++){var a=v[n];var s=a.run(this,t,i,r);if(s){m("syncPoint found via <"+a.name+">:",s);return s}}return null}},{key:"saveExpiredSegmentInfo",value:function e(t,i){var r=i.mediaSequence-t.mediaSequence;for(var n=r-1;n>=0;n--){var a=t.segments[n];if(typeof a.start!=="undefined"){i.syncInfo={mediaSequence:t.mediaSequence+n,time:a.start};m("playlist sync:",i.syncInfo);this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMapping",value:function e(t){if(!this.datetimeToDisplayTime&&t.dateTimeObject){var i=t.dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-i}}},{key:"reset",value:function e(){this.inspectCache_=undefined}},{key:"probeSegmentInfo",value:function e(t){var i=t.segment;var r=undefined;if(i.map){r=this.probeMp4Segment_(t)}else{r=this.probeTsSegment_(t)}if(r){if(this.calculateSegmentTimeMapping_(t,r)){this.saveDiscontinuitySyncInfo_(t)}}}},{key:"probeMp4Segment_",value:function e(t){var i=t.segment;var r=f["default"].timescale(i.map.bytes);var n=f["default"].startTime(r,t.bytes);if(t.timestampOffset!==null){t.timestampOffset-=n}return{start:n,end:n+i.duration}}},{key:"probeTsSegment_",value:function e(t){var i=(0,d.inspect)(t.bytes,this.inspectCache_);var r=undefined;var n=undefined;if(!i){return null}if(i.video&&i.video.length===2){this.inspectCache_=i.video[1].dts;r=i.video[0].dtsTime;n=i.video[1].dtsTime}else if(i.audio&&i.audio.length===2){this.inspectCache_=i.audio[1].dts;r=i.audio[0].dtsTime;n=i.audio[1].dtsTime}return{start:r,end:n}}},{key:"calculateSegmentTimeMapping_",value:function e(t,i){var r=t.segment;var n=this.timelines[t.timeline];if(t.timestampOffset!==null){m("tsO:",t.timestampOffset);n={time:t.timestampOffset,mapping:t.timestampOffset-i.start};this.timelines[t.timeline]=n;r.start=t.timestampOffset;r.end=i.end+n.mapping}else if(n){r.start=i.start+n.mapping;r.end=i.end+n.mapping}else{return false}this.trigger("syncinfoupdate");return true}},{key:"saveDiscontinuitySyncInfo_",value:function e(t){var i=t.playlist;var r=t.segment;if(r.discontinuity){this.discontinuities[r.timeline]={time:r.start,accuracy:0}}else if(i.discontinuityStarts.length){for(var n=0;n<i.discontinuityStarts.length;n++){var a=i.discontinuityStarts[n];var s=i.discontinuitySequence+n+1;var o=a-t.mediaIndex;if(o>0&&(!this.discontinuities[s]||this.discontinuities[s].accuracy>o)){this.discontinuities[s]={time:r.end+(0,l.sumDurations)(i,t.mediaIndex+1,a),accuracy:o}}}}}}]);return t}(h["default"].EventTarget);i["default"]=y}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./playlist":8,"mux.js/lib/mp4/probe":38,"mux.js/lib/tools/ts-inspector.js":39}],17:[function(e,t,i){(function(e){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=typeof window!=="undefined"?window["videojs"]:typeof e!=="undefined"?e["videojs"]:null;var n=function e(){var t=function e(t,i){t=(0,r.mergeOptions)({timeout:45e3},t);if(e.beforeRequest&&typeof e.beforeRequest==="function"){var n=e.beforeRequest(t);if(n){t=n}}var a=(0,r.xhr)(t,function(e,t){if(!e&&a.response){a.responseTime=Date.now();a.roundTripTime=a.responseTime-a.requestTime;a.bytesReceived=a.response.byteLength||a.response.length;if(!a.bandwidth){a.bandwidth=Math.floor(a.bytesReceived/a.roundTripTime*8*1e3)}}if(e||a.timedout){a.timedout=a.timedout||e.code==="ETIMEDOUT"}else{a.timedout=false}if(!e&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0){e=new Error("XHR Failed with a response of: "+(a&&(a.response||a.responseText)))}i(e,a)});a.requestTime=Date.now();return a};return t};i["default"]=n;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],18:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var a=function e(){var t=[[[],[],[],[],[]],[[],[],[],[],[]]];var i=t[0];var r=t[1];var n=i[4];var a=r[4];var s=undefined;var o=undefined;var u=undefined;var f=[];var d=[];var l=undefined;var c=undefined;var h=undefined;var p=undefined;var m=undefined;var v=undefined;for(s=0;s<256;s++){d[(f[s]=s<<1^(s>>7)*283)^s]=s}for(o=u=0;!n[o];o^=l||1,u=d[u]||1){p=u^u<<1^u<<2^u<<3^u<<4;p=p>>8^p&255^99;n[o]=p;a[p]=o;h=f[c=f[l=f[o]]];v=h*16843009^c*65537^l*257^o*16843008;m=f[p]*257^p*16843008;for(s=0;s<4;s++){i[s][o]=m=m<<24^m>>>8;r[s][p]=v=v<<24^v>>>8}}for(s=0;s<5;s++){i[s]=i[s].slice(0);r[s]=r[s].slice(0)}return t};var s=null;var o=function(){function e(t){n(this,e);if(!s){s=a()}this._tables=[[s[0][0].slice(),s[0][1].slice(),s[0][2].slice(),s[0][3].slice(),s[0][4].slice()],[s[1][0].slice(),s[1][1].slice(),s[1][2].slice(),s[1][3].slice(),s[1][4].slice()]];var i=undefined;var r=undefined;var o=undefined;var u=undefined;var f=undefined;var d=this._tables[0][4];var l=this._tables[1];var c=t.length;var h=1;if(c!==4&&c!==6&&c!==8){throw new Error("Invalid aes key size")}u=t.slice(0);f=[];this._key=[u,f];for(i=c;i<4*c+28;i++){o=u[i-1];if(i%c===0||c===8&&i%c===4){o=d[o>>>24]<<24^d[o>>16&255]<<16^d[o>>8&255]<<8^d[o&255];if(i%c===0){o=o<<8^o>>>24^h<<24;h=h<<1^(h>>7)*283}}u[i]=u[i-c]^o}for(r=0;i;r++,i--){o=u[r&3?i:i-4];if(i<=4||r<4){f[r]=o}else{f[r]=l[0][d[o>>>24]]^l[1][d[o>>16&255]]^l[2][d[o>>8&255]]^l[3][d[o&255]]}}}r(e,[{key:"decrypt",value:function e(t,i,r,n,a,s){var o=this._key[1];var u=t^o[0];var f=n^o[1];var d=r^o[2];var l=i^o[3];var c=undefined;var h=undefined;var p=undefined;var m=o.length/4-2;var v=undefined;var y=4;var g=this._tables[1];var b=g[0];var _=g[1];var T=g[2];var w=g[3];var S=g[4];for(v=0;v<m;v++){c=b[u>>>24]^_[f>>16&255]^T[d>>8&255]^w[l&255]^o[y];h=b[f>>>24]^_[d>>16&255]^T[l>>8&255]^w[u&255]^o[y+1];p=b[d>>>24]^_[l>>16&255]^T[u>>8&255]^w[f&255]^o[y+2];l=b[l>>>24]^_[u>>16&255]^T[f>>8&255]^w[d&255]^o[y+3];y+=4;u=c;f=h;d=p}for(v=0;v<4;v++){a[(3&-v)+s]=S[u>>>24]<<24^S[f>>16&255]<<16^S[d>>8&255]<<8^S[l&255]^o[y++];c=u;u=f;f=d;d=l;l=c}}}]);return e}();i["default"]=o;t.exports=i["default"]},{}],19:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var n=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function o(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var u=e("./stream");var f=a(u);var d=function(e){o(t,e);function t(){s(this,t);n(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,f["default"]);this.jobs=[];this.delay=1;this.timeout_=null}r(t,[{key:"processJob_",value:function e(){this.jobs.shift()();if(this.jobs.length){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}else{this.timeout_=null}}},{key:"push",value:function e(t){this.jobs.push(t);if(!this.timeout_){this.timeout_=setTimeout(this.processJob_.bind(this),this.delay)}}}]);return t}(f["default"]);i["default"]=d;t.exports=i["default"]},{"./stream":22}],20:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var s=e("./aes");var o=n(s);var u=e("./async-stream");var f=n(u);var d=e("pkcs7");var l=function e(t){return t<<24|(t&65280)<<8|(t&16711680)>>8|t>>>24};var c=function e(t,i,r){var n=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2);var a=new o["default"](Array.prototype.slice.call(i));var s=new Uint8Array(t.byteLength);var u=new Int32Array(s.buffer);var f=undefined;var d=undefined;var c=undefined;var h=undefined;var p=undefined;var m=undefined;var v=undefined;var y=undefined;var g=undefined;f=r[0];d=r[1];c=r[2];h=r[3];for(g=0;g<n.length;g+=4){p=l(n[g]);m=l(n[g+1]);v=l(n[g+2]);y=l(n[g+3]);a.decrypt(p,m,v,y,u,g);u[g]=l(u[g]^f);u[g+1]=l(u[g+1]^d);u[g+2]=l(u[g+2]^c);u[g+3]=l(u[g+3]^h);f=p;d=m;c=v;h=y}return s};i.decrypt=c;var h=function(){function e(t,i,r,n){a(this,e);var s=e.STEP;var o=new Int32Array(t.buffer);var u=new Uint8Array(t.byteLength);var c=0;this.asyncStream_=new f["default"];this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,r,u));for(c=s;c<o.length;c+=s){r=new Uint32Array([l(o[c-4]),l(o[c-3]),l(o[c-2]),l(o[c-1])]);this.asyncStream_.push(this.decryptChunk_(o.subarray(c,c+s),i,r,u))}this.asyncStream_.push(function(){n(null,(0,d.unpad)(u))})}r(e,[{key:"decryptChunk_",value:function e(t,i,r,n){return function(){var e=c(t,i,r);n.set(e,t.byteOffset)}}}],[{key:"STEP",get:function e(){return 32e3}}]);return e}();i.Decrypter=h;i["default"]={Decrypter:h,decrypt:c}},{"./aes":18,"./async-stream":19,pkcs7:24}],21:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=e("./decrypter");var a=e("./async-stream");var s=r(a);i["default"]={decrypt:n.decrypt,Decrypter:n.Decrypter,AsyncStream:s["default"]};t.exports=i["default"]},{"./async-stream":19,"./decrypter":20}],22:[function(e,t,i){arguments[4][15][0].apply(i,arguments)},{dup:15}],23:[function(e,t,i){"use strict";var r;t.exports=function e(t){var i=r[t.byteLength%16||0],n=new Uint8Array(t.byteLength+i.length);n.set(t);n.set(i,t.byteLength);return n};r=[[16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15],[14,14,14,14,14,14,14,14,14,14,14,14,14,14],[13,13,13,13,13,13,13,13,13,13,13,13,13],[12,12,12,12,12,12,12,12,12,12,12,12],[11,11,11,11,11,11,11,11,11,11,11],[10,10,10,10,10,10,10,10,10,10],[9,9,9,9,9,9,9,9,9],[8,8,8,8,8,8,8,8],[7,7,7,7,7,7,7],[6,6,6,6,6,6],[5,5,5,5,5],[4,4,4,4],[3,3,3],[2,2],[1]]},{}],24:[function(e,t,i){"use strict";i.pad=e("./pad.js");i.unpad=e("./unpad.js")},{"./pad.js":23,"./unpad.js":25}],25:[function(e,t,i){"use strict";t.exports=function e(t){return t.subarray(0,t.byteLength-t[t.byteLength-1])}},{}],26:[function(e,t,i){},{}],27:[function(e,t,i){(function(i){var r=typeof i!=="undefined"?i:typeof window!=="undefined"?window:{};var n=e("min-document");if(typeof document!=="undefined"){t.exports=document}else{var a=r["__GLOBAL_DOCUMENT_CACHE@4"];if(!a){a=r["__GLOBAL_DOCUMENT_CACHE@4"]=n}t.exports=a}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":26}],28:[function(e,t,i){(function(e){if(typeof window!=="undefined"){t.exports=window}else if(typeof e!=="undefined"){t.exports=e}else if(typeof self!=="undefined"){t.exports=self}else{t.exports={}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],29:[function(e,t,i){"use strict";var r=e("./line-stream");var n=f(r);var a=e("./parse-stream");var s=f(a);var o=e("./parser");var u=f(o);function f(e){return e&&e.__esModule?e:{default:e}}t.exports={LineStream:n["default"],ParseStream:s["default"],Parser:u["default"]}},{"./line-stream":30,"./parse-stream":31,"./parser":32}],30:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var n=e("./stream");var a=s(n);function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function f(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var d=function(e){f(t,e);function t(){o(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.buffer="";return e}r(t,[{key:"push",value:function e(t){var i=void 0;this.buffer+=t;i=this.buffer.indexOf("\n");for(;i>-1;i=this.buffer.indexOf("\n")){this.trigger("data",this.buffer.substring(0,i));this.buffer=this.buffer.substring(i+1)}}}]);return t}(a["default"]);i["default"]=d},{"./stream":33}],31:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){var i=[];var r=true;var n=false;var a=undefined;try{for(var s=e[Symbol.iterator](),o;!(r=(o=s.next()).done);r=true){i.push(o.value);if(t&&i.length===t)break}}catch(e){n=true;a=e}finally{try{if(!r&&s["return"])s["return"]()}finally{if(n)throw a}}return i}return function(t,i){if(Array.isArray(t)){return t}else if(Symbol.iterator in Object(t)){return e(t,i)}else{throw new TypeError("Invalid attempt to destructure non-iterable instance")}}}();var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=e("./stream");var s=o(a);function o(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function f(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var l=function e(){var t="[^=]*";var i='"[^"]*"|[^,]*';var r="(?:"+t+")=(?:"+i+")";return new RegExp("(?:^|,)("+r+")")};var c=function e(t){var i=t.split(l());var r={};var n=i.length;var a=void 0;while(n--){if(i[n]===""){continue}a=/([^=]*)=(.*)/.exec(i[n]).slice(1);a[0]=a[0].replace(/^\s+|\s+$/g,"");a[1]=a[1].replace(/^\s+|\s+$/g,"");a[1]=a[1].replace(/^['"](.*)['"]$/g,"$1");r[a[0]]=a[1]}return r};var h=function(e){d(t,e);function t(){u(this,t);return f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}n(t,[{key:"push",value:function e(t){var i=void 0;var n=void 0;t=t.replace(/^[\u0000\s]+|[\u0000\s]+$/g,"");if(t.length===0){return}if(t[0]!=="#"){this.trigger("data",{type:"uri",uri:t});return}if(t.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:t.slice(1)});return}t=t.replace("\r","");i=/^#EXTM3U/.exec(t);if(i){this.trigger("data",{type:"tag",tagType:"m3u"});return}i=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(t);if(i){n={type:"tag",tagType:"inf"};if(i[1]){n.duration=parseFloat(i[1])}if(i[2]){n.title=i[2]}this.trigger("data",n);return}i=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"targetduration"};if(i[1]){n.duration=parseInt(i[1],10)}this.trigger("data",n);return}i=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"totalduration"};if(i[1]){n.duration=parseInt(i[1],10)}this.trigger("data",n);return}i=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"version"};if(i[1]){n.version=parseInt(i[1],10)}this.trigger("data",n);return}i=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"media-sequence"};if(i[1]){n.number=parseInt(i[1],10)}this.trigger("data",n);return}i=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"discontinuity-sequence"};if(i[1]){n.number=parseInt(i[1],10)}this.trigger("data",n);return}i=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(t);if(i){n={type:"tag",tagType:"playlist-type"};if(i[1]){n.playlistType=i[1]}this.trigger("data",n);return}i=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(t);if(i){n={type:"tag",tagType:"byterange"};if(i[1]){n.length=parseInt(i[1],10)}if(i[2]){n.offset=parseInt(i[2],10)}this.trigger("data",n);return}i=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(t);if(i){n={type:"tag",tagType:"allow-cache"};if(i[1]){n.allowed=!/NO/.test(i[1])}this.trigger("data",n);return}i=/^#EXT-X-MAP:?(.*)$/.exec(t);if(i){n={type:"tag",tagType:"map"};if(i[1]){var a=c(i[1]);if(a.URI){n.uri=a.URI}if(a.BYTERANGE){var s=a.BYTERANGE.split("@"),o=r(s,2),u=o[0],f=o[1];n.byterange={};if(u){n.byterange.length=parseInt(u,10)}if(f){n.byterange.offset=parseInt(f,10)}}}this.trigger("data",n);return}i=/^#EXT-X-STREAM-INF:?(.*)$/.exec(t);if(i){n={type:"tag",tagType:"stream-inf"};if(i[1]){n.attributes=c(i[1]);if(n.attributes.RESOLUTION){var d=n.attributes.RESOLUTION.split("x");var l={};if(d[0]){l.width=parseInt(d[0],10)}if(d[1]){l.height=parseInt(d[1],10)}n.attributes.RESOLUTION=l}if(n.attributes.BANDWIDTH){n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)}if(n.attributes["PROGRAM-ID"]){n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10)}}this.trigger("data",n);return}i=/^#EXT-X-MEDIA:?(.*)$/.exec(t);if(i){n={type:"tag",tagType:"media"};if(i[1]){n.attributes=c(i[1])}this.trigger("data",n);return}i=/^#EXT-X-ENDLIST/.exec(t);if(i){this.trigger("data",{type:"tag",tagType:"endlist"});return}i=/^#EXT-X-DISCONTINUITY/.exec(t);if(i){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}i=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(t);if(i){n={type:"tag",tagType:"program-date-time"};if(i[1]){n.dateTimeString=i[1];n.dateTimeObject=new Date(i[1])}this.trigger("data",n);return}i=/^#EXT-X-KEY:?(.*)$/.exec(t);if(i){n={type:"tag",tagType:"key"};if(i[1]){n.attributes=c(i[1]);if(n.attributes.IV){if(n.attributes.IV.substring(0,2).toLowerCase()==="0x"){n.attributes.IV=n.attributes.IV.substring(2)}n.attributes.IV=n.attributes.IV.match(/.{8}/g);n.attributes.IV[0]=parseInt(n.attributes.IV[0],16);n.attributes.IV[1]=parseInt(n.attributes.IV[1],16);n.attributes.IV[2]=parseInt(n.attributes.IV[2],16);n.attributes.IV[3]=parseInt(n.attributes.IV[3],16);n.attributes.IV=new Uint32Array(n.attributes.IV)}}this.trigger("data",n);return}i=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(t);if(i){n={type:"tag",tagType:"cue-out-cont"};if(i[1]){n.data=i[1]}else{n.data=""}this.trigger("data",n);return}i=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(t);if(i){n={type:"tag",tagType:"cue-out"};if(i[1]){n.data=i[1]}else{n.data=""}this.trigger("data",n);return}i=/^#EXT-X-CUE-IN:?(.*)?$/.exec(t);if(i){n={type:"tag",tagType:"cue-in"};if(i[1]){n.data=i[1]}else{n.data=""}this.trigger("data",n);return}this.trigger("data",{type:"tag",data:t.slice(4)})}}]);return t}(s["default"]);i["default"]=h},{"./stream":33}],32:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i){if(Object.prototype.hasOwnProperty.call(i,r)){e[r]=i[r]}}}return e};var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=e("./stream");var s=l(a);var o=e("./line-stream");var u=l(o);var f=e("./parse-stream");var d=l(f);function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function p(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var m=function(e){p(t,e);function t(){c(this,t);var e=h(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));e.lineStream=new u["default"];e.parseStream=new d["default"];e.lineStream.pipe(e.parseStream);var i=e;var n=[];var a={};var s=void 0;var o=void 0;var f=function e(){};var l={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}};var p=0;e.manifest={allowCache:true,discontinuityStarts:[],segments:[]};e.parseStream.on("data",function(e){var t=void 0;var u=void 0;({tag:function d(){(({"allow-cache":function t(){this.manifest.allowCache=e.allowed;if(!("allowed"in e)){this.trigger("info",{message:"defaulting allowCache to YES"});this.manifest.allowCache=true}},byterange:function t(){var t={};if("length"in e){a.byterange=t;t.length=e.length;if(!("offset"in e)){this.trigger("info",{message:"defaulting offset to zero"});e.offset=0}}if("offset"in e){a.byterange=t;t.offset=e.offset}},endlist:function e(){this.manifest.endList=true},inf:function t(){if(!("mediaSequence"in this.manifest)){this.manifest.mediaSequence=0;this.trigger("info",{message:"defaulting media sequence to zero"})}if(!("discontinuitySequence"in this.manifest)){this.manifest.discontinuitySequence=0;this.trigger("info",{message:"defaulting discontinuity sequence to zero"})}if(e.duration>0){a.duration=e.duration}if(e.duration===0){a.duration=.01;this.trigger("info",{message:"updating zero segment duration to a small value"})}this.manifest.segments=n},key:function t(){if(!e.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(e.attributes.METHOD==="NONE"){o=null;return}if(!e.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(!e.attributes.METHOD){this.trigger("warn",{message:"defaulting key method to AES-128"})}o={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI};if(typeof e.attributes.IV!=="undefined"){o.iv=e.attributes.IV}},"media-sequence":function t(){if(!isFinite(e.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number});return}this.manifest.mediaSequence=e.number},"discontinuity-sequence":function t(){if(!isFinite(e.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number});return}this.manifest.discontinuitySequence=e.number;p=e.number},"playlist-type":function t(){if(!/VOD|EVENT/.test(e.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist});return}this.manifest.playlistType=e.playlistType},map:function t(){s={};if(e.uri){s.uri=e.uri}if(e.byterange){s.byterange=e.byterange}},"stream-inf":function t(){this.manifest.playlists=n;this.manifest.mediaGroups=this.manifest.mediaGroups||l;if(!e.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}if(!a.attributes){a.attributes={}}r(a.attributes,e.attributes)},media:function i(){this.manifest.mediaGroups=this.manifest.mediaGroups||l;if(!(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}var r=this.manifest.mediaGroups[e.attributes.TYPE];r[e.attributes["GROUP-ID"]]=r[e.attributes["GROUP-ID"]]||{};t=r[e.attributes["GROUP-ID"]];u={default:/yes/i.test(e.attributes.DEFAULT)};if(u["default"]){u.autoselect=true}else{u.autoselect=/yes/i.test(e.attributes.AUTOSELECT)}if(e.attributes.LANGUAGE){u.language=e.attributes.LANGUAGE}if(e.attributes.URI){u.uri=e.attributes.URI}if(e.attributes["INSTREAM-ID"]){u.instreamId=e.attributes["INSTREAM-ID"]}t[e.attributes.NAME]=u},discontinuity:function e(){p+=1;a.discontinuity=true;this.manifest.discontinuityStarts.push(n.length)},"program-date-time":function t(){this.manifest.dateTimeString=e.dateTimeString;this.manifest.dateTimeObject=e.dateTimeObject},targetduration:function t(){if(!isFinite(e.duration)||e.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration});return}this.manifest.targetDuration=e.duration},totalduration:function t(){if(!isFinite(e.duration)||e.duration<0){this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration});return}this.manifest.totalDuration=e.duration},"cue-out":function t(){a.cueOut=e.data},"cue-out-cont":function t(){a.cueOutCont=e.data},"cue-in":function t(){a.cueIn=e.data}})[e.tagType]||f).call(i)},uri:function t(){a.uri=e.uri;n.push(a);if(this.manifest.targetDuration&&!("duration"in a)){this.trigger("warn",{message:"defaulting segment duration to the target duration"});a.duration=this.manifest.targetDuration}if(o){a.key=o}a.timeline=p;if(s){a.map=s}a={}},comment:function e(){}})[e.type].call(i)});return e}n(t,[{key:"push",value:function e(t){this.lineStream.push(t)}},{key:"end",value:function e(){this.lineStream.push("\n")}}]);return t}(s["default"]);i["default"]=m},{"./line-stream":30,"./parse-stream":31,"./stream":33}],33:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var a=function(){function e(){n(this,e);this.listeners={}}r(e,[{key:"on",value:function e(t,i){if(!this.listeners[t]){this.listeners[t]=[]}this.listeners[t].push(i)}},{key:"off",value:function e(t,i){if(!this.listeners[t]){return false}var r=this.listeners[t].indexOf(i);this.listeners[t].splice(r,1);return r>-1}},{key:"trigger",value:function e(t){var i=this.listeners[t];var r=void 0;var n=void 0;var a=void 0;if(!i){return}if(arguments.length===2){n=i.length;for(r=0;r<n;++r){i[r].call(this,arguments[1])}}else{a=Array.prototype.slice.call(arguments,1);n=i.length;for(r=0;r<n;++r){i[r].apply(this,a)}}}},{key:"dispose",value:function e(){this.listeners={}}},{key:"pipe",value:function e(t){this.on("data",function(e){t.push(e)})}}]);return e}();i["default"]=a},{}],34:[function(e,t,i){"use strict";var r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];var n=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]};var a=function(e,t,i){var r,n="";for(r=t;r<i;r++){n+="%"+("00"+e[r].toString(16)).slice(-2)}return n};var s=function(e,t,i){return unescape(a(e,t,i))};var o=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=e[t+5],n=(r&16)>>4;if(n){return i+20}return i+10};var u=function(e,t){var i=(e[t+5]&224)>>5,r=e[t+4]<<3,n=e[t+3]&3<<11;return n|r|i};var f=function(e,t){if(e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)){return"timed-metadata"}else if(e[t]&255===255&&(e[t+1]&240)===240){return"audio"}return null};var d=function(e){var t=0;while(t+5<e.length){if(e[t]!==255||(e[t+1]&246)!==240){t++;continue}return r[(e[t+2]&60)>>>2]}return null};var l=function(e){var t,i,r,a;t=10;if(e[5]&64){t+=4;t+=n(e.subarray(10,14))}do{i=n(e.subarray(t+4,t+8));if(i<1){return null}a=String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3]);if(a==="PRIV"){r=e.subarray(t+10,t+i+10);for(var o=0;o<r.byteLength;o++){if(r[o]===0){var u=s(r,0,o);if(u==="com.apple.streaming.transportStreamTimestamp"){var f=r.subarray(o+1);var d=(f[3]&1)<<30|f[4]<<22|f[5]<<14|f[6]<<6|f[7]>>>2;d*=4;d+=f[7]&3;return d}break}}}t+=10;t+=i}while(t<e.byteLength);return null};t.exports={parseId3TagSize:o,parseAdtsSize:u,parseType:f,parseSampleRate:d,parseAacTimestamp:l}},{}],35:[function(e,t,i){"use strict";var r=e("./stream-types.js");var n=function(e){var t=e[1]&31;t<<=8;t|=e[2];return t};var a=function(e){return!!(e[1]&64)};var s=function(e){var t=0;if((e[3]&48)>>>4>1){t+=e[4]+1}return t};var o=function(e,t){var i=n(e);if(i===0){return"pat"}else if(i===t){return"pmt"}else if(t){return"pes"}return null};var u=function(e){var t=a(e);var i=4+s(e);if(t){i+=e[i]+1}return(e[i+10]&31)<<8|e[i+11]};var f=function(e){var t={};var i=a(e);var r=4+s(e);if(i){r+=e[r]+1}if(!(e[r+5]&1)){return}var n,o,u;n=(e[r+1]&15)<<8|e[r+2];o=3+n-4;u=(e[r+10]&15)<<8|e[r+11];var f=12+u;while(f<o){var d=r+f;t[(e[d+1]&31)<<8|e[d+2]]=e[d];f+=((e[d+3]&15)<<8|e[d+4])+5}return t};var d=function(e,t){var i=n(e);var a=t[i];switch(a){case r.H264_STREAM_TYPE:return"video";case r.ADTS_STREAM_TYPE:return"audio";case r.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}};var l=function(e){var t=a(e);if(!t){return null}var i=4+s(e);var r={};var n;n=e[i+7];if(n&192){r.pts=(e[i+9]&14)<<27|(e[i+10]&255)<<20|(e[i+11]&254)<<12|(e[i+12]&255)<<5|(e[i+13]&254)>>>3;r.pts*=4;r.pts+=(e[i+13]&6)>>>1;r.dts=r.pts;if(n&64){r.dts=(e[i+14]&14)<<27|(e[i+15]&255)<<20|(e[i+16]&254)<<12|(e[i+17]&255)<<5|(e[i+18]&254)>>>3;r.dts*=4;r.dts+=(e[i+18]&6)>>>1}}return r};var c=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}};var h=function(e){var t=4+s(e);var i=e.subarray(t);var r=0;var n=0;var a=false;var o;for(;n<i.byteLength-3;n++){if(i[n+2]===1){r=n+5;break}}while(r<i.byteLength){switch(i[r]){case 0:if(i[r-1]!==0){r+=2;break}else if(i[r-2]!==0){r++;break}if(n+3!==r-2){o=c(i[n+3]&31);if(o==="slice_layer_without_partitioning_rbsp_idr"){a=true}}do{r++}while(i[r]!==1&&r<i.length);n=r-2;r+=3;break;case 1:if(i[r-1]!==0||i[r-2]!==0){r+=3;break}o=c(i[n+3]&31);if(o==="slice_layer_without_partitioning_rbsp_idr"){a=true}n=r-2;r+=3;break;default:r+=3;break}}i=i.subarray(n);r-=n;n=0;if(i&&i.byteLength>3){o=c(i[n+3]&31);if(o==="slice_layer_without_partitioning_rbsp_idr"){a=true}}return a};t.exports={parseType:o,parsePat:u,parsePmt:f,parsePayloadUnitStartIndicator:a,parsePesType:d,parsePesTime:l,videoPacketContainsKeyFrame:h}},{"./stream-types.js":36}],36:[function(e,t,i){"use strict";t.exports={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}},{}],37:[function(e,t,i){"use strict";var r=e("../utils/stream");var n=8589934592;var a=4294967296;var s=function(e,t){var i=1;if(e>t){i=-1}while(Math.abs(t-e)>a){e+=i*n}return e};var o=function(e){var t,i;o.prototype.init.call(this);this.type_=e;this.push=function(e){if(e.type!==this.type_){return}if(i===undefined){i=e.dts}e.dts=s(e.dts,i);e.pts=s(e.pts,i);t=e.dts;this.trigger("data",e)};this.flush=function(){i=t;this.trigger("done")}};o.prototype=new r;t.exports={TimestampRolloverStream:o,handleRollover:s}},{"../utils/stream":40}],38:[function(e,t,i){"use strict";var r,n,a,s;r=function(e,t){var i=[],a,s,o,u,f;if(!t.length){return null}for(a=0;a<e.byteLength;){s=e[a]<<24;s|=e[a+1]<<16;s|=e[a+2]<<8;s|=e[a+3];o=n(e.subarray(a+4,a+8));u=s>1?a+s:e.byteLength;if(o===t[0]){if(t.length===1){i.push(e.subarray(a+8,u))}else{f=r(e.subarray(a+8,u),t.slice(1));if(f.length){i=i.concat(f)}}}a=u}return i};n=function(e){var t="";t+=String.fromCharCode(e[0]);t+=String.fromCharCode(e[1]);t+=String.fromCharCode(e[2]);t+=String.fromCharCode(e[3]);return t};a=function(e){var t={},i=r(e,["moov","trak"]);return i.reduce(function(e,t){var i,n,a,s,o;i=r(t,["tkhd"])[0];if(!i){return null}n=i[0];a=n===0?12:20;s=i[a]<<24|i[a+1]<<16|i[a+2]<<8|i[a+3];o=r(t,["mdia","mdhd"])[0];if(!o){return null}n=o[0];a=n===0?12:20;e[s]=o[a]<<24|o[a+1]<<16|o[a+2]<<8|o[a+3];return e},t)};s=function(e,t){var i,n,a;i=r(t,["moof","traf"]);n=[].concat.apply([],i.map(function(t){return r(t,["tfhd"]).map(function(i){var n,a,s;n=i[4]<<24|i[5]<<16|i[6]<<8|i[7];a=e[n]||9e4;s=r(t,["tfdt"]).map(function(e){var t,i;t=e[0];i=e[4]<<24|e[5]<<16|e[6]<<8|e[7];if(t===1){i*=Math.pow(2,32);i+=e[8]<<24|e[9]<<16|e[10]<<8|e[11]}return i})[0];s=s||Infinity;return s/a})}));a=Math.min.apply(null,n);return isFinite(a)?a:0};t.exports={parseType:n,timescale:a,startTime:s}},{}],39:[function(e,t,i){"use strict";var r=e("../m2ts/stream-types.js");var n=e("../m2ts/timestamp-rollover-stream.js").handleRollover;var a={};a.ts=e("../m2ts/probe.js");a.aac=e("../aac/probe.js");var s=9e4,o=188,u=71;var f=function(e){if(e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)){return true}return false};var d=function(e,t){var i=0,r=o,n,s;while(r<e.byteLength){if(e[i]===u&&e[r]===u){n=e.subarray(i,r);s=a.ts.parseType(n,t.pid);switch(s){case"pat":if(!t.pid){t.pid=a.ts.parsePat(n)}break;case"pmt":if(!t.table){t.table=a.ts.parsePmt(n)}break;default:break}if(t.pid&&t.table){return}i+=o;r+=o;continue}i++;r++}};var l=function(e,t,i){var r=0,n=o,s,f,d,l,c;var h=false;while(n<e.byteLength){if(e[r]===u&&e[n]===u){s=e.subarray(r,n);f=a.ts.parseType(s,t.pid);switch(f){case"pes":d=a.ts.parsePesType(s,t.table);l=a.ts.parsePayloadUnitStartIndicator(s);if(d==="audio"&&l){c=a.ts.parsePesTime(s);c.type="audio";i.audio.push(c);h=true}break;default:break}if(h){break}r+=o;n+=o;continue}r++;n++}n=e.byteLength;r=n-o;h=false;while(r>=0){if(e[r]===u&&e[n]===u){s=e.subarray(r,n);f=a.ts.parseType(s,t.pid);switch(f){case"pes":d=a.ts.parsePesType(s,t.table);l=a.ts.parsePayloadUnitStartIndicator(s);if(d==="audio"&&l){c=a.ts.parsePesTime(s);c.type="audio";i.audio.push(c);h=true}break;default:break}if(h){break}r-=o;n-=o;continue}r--;n--}};var c=function(e,t,i){var r=0,n=o,s,f,d,l,c,h,p,m;var v=false;var y={data:[],size:0};while(n<e.byteLength){if(e[r]===u&&e[n]===u){s=e.subarray(r,n);f=a.ts.parseType(s,t.pid);switch(f){case"pes":d=a.ts.parsePesType(s,t.table);l=a.ts.parsePayloadUnitStartIndicator(s);if(d==="video"){if(l&&!v){c=a.ts.parsePesTime(s);c.type="video";i.video.push(c);v=true}if(!i.firstKeyFrame){if(l){if(y.size!==0){h=new Uint8Array(y.size);p=0;while(y.data.length){m=y.data.shift();h.set(m,p);p+=m.byteLength}if(a.ts.videoPacketContainsKeyFrame(h)){i.firstKeyFrame=a.ts.parsePesTime(h);i.firstKeyFrame.type="video"}y.size=0}}y.data.push(s);y.size+=s.byteLength}}break;default:break}if(v&&i.firstKeyFrame){break}r+=o;n+=o;continue}r++;n++}n=e.byteLength;r=n-o;v=false;while(r>=0){if(e[r]===u&&e[n]===u){s=e.subarray(r,n);f=a.ts.parseType(s,t.pid);switch(f){case"pes":d=a.ts.parsePesType(s,t.table);l=a.ts.parsePayloadUnitStartIndicator(s);if(d==="video"&&l){c=a.ts.parsePesTime(s);c.type="video";i.video.push(c);v=true}break;default:break}if(v){break}r-=o;n-=o;continue}r--;n--}};var h=function(e,t){if(e.audio&&e.audio.length){var i=t;if(typeof i==="undefined"){i=e.audio[0].dts}e.audio.forEach(function(e){e.dts=n(e.dts,i);e.pts=n(e.pts,i);e.dtsTime=e.dts/s;e.ptsTime=e.pts/s})}if(e.video&&e.video.length){var r=t;if(typeof r==="undefined"){r=e.video[0].dts}e.video.forEach(function(e){e.dts=n(e.dts,r);e.pts=n(e.pts,r);e.dtsTime=e.dts/s;e.ptsTime=e.pts/s});if(e.firstKeyFrame){var a=e.firstKeyFrame;a.dts=n(a.dts,r);a.pts=n(a.pts,r);a.dtsTime=a.dts/s;a.ptsTime=a.dts/s}}};var p=function(e){var t=false,i=0,r=null,n=null,o=0,u=0,f;while(e.length-u>=3){var d=a.aac.parseType(e,u);switch(d){case"timed-metadata":if(e.length-u<10){t=true;break}o=a.aac.parseId3TagSize(e,u);if(o>e.length){t=true;break}if(n===null){f=e.subarray(u,u+o);n=a.aac.parseAacTimestamp(f)}u+=o;break;case"audio":if(e.length-u<7){t=true;break}o=a.aac.parseAdtsSize(e,u);if(o>e.length){t=true;break}if(r===null){f=e.subarray(u,u+o);r=a.aac.parseSampleRate(f)}i++;u+=o;break;default:u++;break}if(t){return null}}if(r===null||n===null){return null}var l=s/r;var c={audio:[{type:"audio",dts:n,pts:n},{type:"audio",dts:n+i*1024*l,pts:n+i*1024*l}]};return c};var m=function(e){var t={pid:null,table:null};var i={};d(e,t);for(var n in t.table){if(t.table.hasOwnProperty(n)){var a=t.table[n];switch(a){case r.H264_STREAM_TYPE:i.video=[];c(e,t,i);if(i.video.length===0){delete i.video}break;case r.ADTS_STREAM_TYPE:i.audio=[];l(e,t,i);if(i.audio.length===0){delete i.audio}break;default:break}}}return i};var v=function(e,t){var i=f(e);var r;if(i){r=p(e)}else{r=m(e)}if(!r||!r.audio&&!r.video){return null}h(r,t);return r};t.exports={inspect:v}},{"../aac/probe.js":34,"../m2ts/probe.js":35,"../m2ts/stream-types.js":36,"../m2ts/timestamp-rollover-stream.js":37}],40:[function(e,t,i){"use strict";var r=function(){this.init=function(){var e={};this.on=function(t,i){if(!e[t]){e[t]=[]}e[t]=e[t].concat(i)};this.off=function(t,i){var r;if(!e[t]){return false}r=e[t].indexOf(i);e[t]=e[t].slice();e[t].splice(r,1);return r>-1};this.trigger=function(t){var i,r,n,a;i=e[t];if(!i){return}if(arguments.length===2){n=i.length;for(r=0;r<n;++r){i[r].call(this,arguments[1])}}else{a=[];r=arguments.length;for(r=1;r<arguments.length;++r){a.push(arguments[r])}n=i.length;for(r=0;r<n;++r){i[r].apply(this,a)}}};this.dispose=function(){e={}}}};r.prototype.pipe=function(e){this.on("data",function(t){e.push(t)});this.on("done",function(t){e.flush(t)});return e};r.prototype.push=function(e){this.trigger("data",e)};r.prototype.flush=function(e){this.trigger("done",e)};t.exports=r},{}],41:[function(t,i,r){(function(t){var n=/^([^#]*)(.*)$/;var a=/^([^\?]*)(.*)$/;var s=/^(([a-z]+:\/\/)?[^:\/]+(?::[0-9]+)?)?(\/?.*)$/i;var o={buildAbsoluteURL:function(e,t){t=t.trim();if(/^[a-z]+:/i.test(t)){return t}var i=null;var r=null;var u=n.exec(t);if(u){r=u[2];t=u[1]}var f=a.exec(t);if(f){i=f[2];t=f[1]}var d=n.exec(e);if(d){e=d[1]}var l=a.exec(e);if(l){e=l[1]}var c=s.exec(e);if(!c){throw new Error("Error trying to parse base URL.")}var h=c[2]||"";var p=c[1]||"";var m=c[3];if(m.indexOf("/")!==0&&p!==""){m="/"+m}var v=null;if(/^\/\//.test(t)){v=h+o.buildAbsolutePath("",t.substring(2))}else if(/^\//.test(t)){v=p+"/"+o.buildAbsolutePath("",t.substring(1))}else{v=o.buildAbsolutePath(p+m,t)}if(i){v+=i}if(r){v+=r}return v},buildAbsolutePath:function(e,t){var i=t;var r,n="",a=e.replace(/[^\/]*$/,i.replace(/(\/|^)(?:\.?\/+)+/g,"$1"));for(var s,o=0;s=a.indexOf("/../",o),s>-1;o=s+r){r=/^\/(?:\.\.\/)*/.exec(a.slice(s))[0].length;n=(n+a.substring(o,s)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(r-1)/3+"}$"),"/")}return n+a.substr(o)}};if(typeof r==="object"&&typeof i==="object")i.exports=o;else if(typeof e==="function"&&e.amd)e([],function(){return o});else if(typeof r==="object")r["URLToolkit"]=o;else t["URLToolkit"]=o})(this)},{}],42:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});function n(e){return e&&e.__esModule?e:{default:e}}var a=e("global/window");var s=n(a);var o=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var u=n(o);var f=function e(t){Object.defineProperties(t.frame,{id:{get:function e(){u["default"].log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");return t.value.key}},value:{get:function e(){u["default"].log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");return t.value.data}},privateData:{get:function e(){u["default"].log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");return t.value.data}}})};var d=function e(t){var i=undefined;if(isNaN(t)||Math.abs(t)===Infinity){i=Number.MAX_VALUE}else{i=t}return i};var l=function e(t,i,r){var n=s["default"].WebKitDataCue||s["default"].VTTCue;if(i){i.forEach(function(e){this.inbandTextTrack_.addCue(new n(e.startTime+this.timestampOffset,e.endTime+this.timestampOffset,e.text))},t)}if(r){var a=d(t.mediaSource_.duration);r.forEach(function(e){var t=e.cueTime+this.timestampOffset;e.frames.forEach(function(e){var i=new n(t,t,e.value||e.url||e.data||"");i.frame=e;i.value=e;f(i);this.metadataTrack_.addCue(i)},this)},t);if(t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length){var o=t.metadataTrack_.cues;var u=[];for(var l=0;l<o.length;l++){u.push(o[l])}u.sort(function(e,t){return e.startTime-t.startTime});for(var c=0;c<u.length-1;c++){if(u[c].endTime!==u[c+1].startTime){u[c].endTime=u[c+1].startTime}}u[u.length-1].endTime=a}}};i["default"]={addTextTrackData:l,durationOfVideo:d};t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"global/window":28}],43:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function e(t,i,r){var n=t.remoteTextTracks()||[];for(var a=0;a<n.length;a++){var s=n[a];if(s.kind===i&&s.label===r){t.removeRemoteTextTrack(s)}}};i.removeExistingTrack=r;var n=function e(t){r(t,"captions","cc1");r(t,"metadata","Timed Metadata")};i.cleanupTextTracks=n},{}],44:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function e(t){return/mp4a\.\d+.\d+/i.test(t)};var n=function e(t){return/avc1\.[\da-f]+/i.test(t)};var a=function e(t){var i={type:"",parameters:{}};var r=t.trim().split(";");i.type=r.shift().trim();r.forEach(function(e){var t=e.trim().split("=");if(t.length>1){var r=t[0].replace(/"/g,"").trim();var n=t[1].replace(/"/g,"").trim();i.parameters[r]=n}});return i};var s=function e(t){return t.map(function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){var r=("00"+Number(t).toString(16)).slice(-2);var n=("00"+Number(i).toString(16)).slice(-2);return"avc1."+r+"00"+n})})};i["default"]={isAudioCodec:r,parseContentType:a,isVideoCodec:n,translateLegacyCodecs:s};t.exports=i["default"]},{}],45:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=e("./cleanup-text-tracks");var n=function e(t,i,n){var a=i.player_;if(n.captions&&n.captions.length&&!t.inbandTextTrack_){(0,r.removeExistingTrack)(a,"captions","cc1");t.inbandTextTrack_=a.addRemoteTextTrack({kind:"captions",label:"cc1"},false).track}if(n.metadata&&n.metadata.length&&!t.metadataTrack_){(0,r.removeExistingTrack)(a,"metadata","Timed Metadata",true);t.metadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},false).track;t.metadataTrack_.inBandMetadataTrackDispatchType=n.metadata.dispatchType}};i["default"]=n;t.exports=i["default"]},{"./cleanup-text-tracks":43}],46:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r={TIME_BETWEEN_CHUNKS:1,BYTES_PER_CHUNK:1024*32};i["default"]=r;t.exports=i["default"]},{}],47:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var f=e("global/document");var d=s(f);var l=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var c=s(l);var h=e("./flash-source-buffer");var p=s(h);var m=e("./flash-constants");var v=s(m);var y=e("./codec-utils");var g=e("./cleanup-text-tracks");var b=function(e){u(t,e);function t(){var e=this;o(this,t);a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);this.sourceBuffers=[];this.readyState="closed";this.on(["sourceopen","webkitsourceopen"],function(t){e.swfObj=d["default"].getElementById(t.swfId);e.player_=(0,c["default"])(e.swfObj.parentNode);e.tech_=e.swfObj.tech;e.readyState="open";e.tech_.on("seeking",function(){var t=e.sourceBuffers.length;while(t--){e.sourceBuffers[t].abort()}});if(e.tech_.hls){e.tech_.hls.on("dispose",function(){(0,g.cleanupTextTracks)(e.player_)})}if(e.swfObj){e.swfObj.vjs_load()}})}n(t,[{key:"addSeekableRange_",value:function e(){}},{key:"addSourceBuffer",value:function e(t){var i=(0,y.parseContentType)(t);var r=undefined;if(i.type==="video/mp2t"){r=new p["default"](this)}else{throw new Error("NotSupportedError (Video.js)")}this.sourceBuffers.push(r);return r}},{key:"endOfStream",value:function e(t){if(t==="network"){this.tech_.error(2)}else if(t==="decode"){this.tech_.error(3)}if(this.readyState!=="ended"){this.readyState="ended";this.swfObj.vjs_endOfStream()}}}]);return t}(c["default"].EventTarget);i["default"]=b;try{Object.defineProperty(b.prototype,"duration",{get:function e(){if(!this.swfObj){return NaN}return this.swfObj.vjs_getProperty("duration")},set:function e(t){var i=undefined;var r=this.swfObj.vjs_getProperty("duration");this.swfObj.vjs_setProperty("duration",t);if(t<r){for(i=0;i<this.sourceBuffers.length;i++){this.sourceBuffers[i].remove(t,r)}}return t}})}catch(e){b.prototype.duration=NaN}for(var _ in v["default"]){b[_]=v["default"][_]}t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./cleanup-text-tracks":43,"./codec-utils":44,"./flash-constants":46,"./flash-source-buffer":48,"global/document":27}],48:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var f=e("global/window");var d=s(f);var l=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var c=s(l);var h=e("mux.js/lib/flv");var p=s(h);var m=e("./remove-cues-from-track");var v=s(m);var y=e("./create-text-tracks-if-necessary");var g=s(y);var b=e("./add-text-track-data");var _=e("./flash-transmuxer-worker");var T=s(_);var w=e("webworkify");var S=s(w);var k=e("./flash-constants");var O=s(k);var P=function e(t){d["default"].setTimeout(t,O["default"].TIME_BETWEEN_CHUNKS)};var A=function e(){return Math.random().toString(36).slice(2,8)};var E=function e(t,i){if(typeof i!=="number"||i<0){i=0}var r=Math.pow(10,i);return Math.round(t*r)/r};var x=function(e){u(t,e);function t(e){var i=this;o(this,t);a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var r=undefined;this.chunkSize_=O["default"].BYTES_PER_CHUNK;this.buffer_=[];this.bufferSize_=0;this.basePtsOffset_=NaN;this.mediaSource_=e;this.updating=false;this.timestampOffset_=0;r=d["default"].btoa(String.fromCharCode.apply(null,Array.prototype.slice.call(p["default"].getFlvHeader())));var n=this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g,"_");this.flashEncodedHeaderName_="vjs_flashEncodedHeader_"+n+A();this.flashEncodedDataName_="vjs_flashEncodedData_"+n+A();d["default"][this.flashEncodedHeaderName_]=function(){delete d["default"][i.flashEncodedHeaderName_];return r};this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_);this.transmuxer_=(0,S["default"])(T["default"]);this.transmuxer_.postMessage({action:"init",options:{}});this.transmuxer_.onmessage=function(e){if(e.data.action==="data"){i.receiveBuffer_(e.data.segment)}};this.one("updateend",function(){i.mediaSource_.tech_.trigger("loadedmetadata")});Object.defineProperty(this,"timestampOffset",{get:function e(){return this.timestampOffset_},set:function e(t){if(typeof t==="number"&&t>=0){this.timestampOffset_=t;this.mediaSource_.swfObj.vjs_discontinuity();this.basePtsOffset_=NaN;this.transmuxer_.postMessage({action:"reset"})}}});Object.defineProperty(this,"buffered",{get:function e(){if(!this.mediaSource_||!this.mediaSource_.swfObj||!("vjs_getProperty"in this.mediaSource_.swfObj)){return c["default"].createTimeRange()}var t=this.mediaSource_.swfObj.vjs_getProperty("buffered");if(t&&t.length){t[0][0]=E(t[0][0],3);t[0][1]=E(t[0][1],3)}return c["default"].createTimeRanges(t)}});this.mediaSource_.player_.on("seeked",function(){(0,v["default"])(0,Infinity,i.metadataTrack_);(0,v["default"])(0,Infinity,i.inbandTextTrack_)});this.mediaSource_.player_.tech_.hls.on("dispose",function(){i.transmuxer_.terminate()})}n(t,[{key:"appendBuffer",value:function e(t){var i=undefined;if(this.updating){i=new Error("SourceBuffer.append() cannot be called "+"while an update is in progress");i.name="InvalidStateError";i.code=11;throw i}this.updating=true;this.mediaSource_.readyState="open";this.trigger({type:"update"});this.transmuxer_.postMessage({action:"push",data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},[t.buffer]);this.transmuxer_.postMessage({action:"flush"})}},{key:"abort",value:function e(){this.buffer_=[];this.bufferSize_=0;this.mediaSource_.swfObj.vjs_abort();if(this.updating){this.updating=false;this.trigger({type:"updateend"})}}},{key:"remove",value:function e(t,i){(0,v["default"])(t,i,this.metadataTrack_);(0,v["default"])(t,i,this.inbandTextTrack_);this.trigger({type:"update"});this.trigger({type:"updateend"})}},{key:"receiveBuffer_",value:function e(t){var i=this;(0,g["default"])(this,this.mediaSource_,t);(0,b.addTextTrackData)(this,t.captions,t.metadata);P(function(){var e=i.convertTagsToData_(t);if(i.buffer_.length===0){P(i.processBuffer_.bind(i))}if(e){i.buffer_.push(e);i.bufferSize_+=e.byteLength}})}},{key:"processBuffer_",value:function e(){var t=this;var i=O["default"].BYTES_PER_CHUNK;if(!this.buffer_.length){if(this.updating!==false){this.updating=false;this.trigger({type:"updateend"})}return}var r=this.buffer_[0].subarray(0,i);if(r.byteLength<i||this.buffer_[0].byteLength===i){this.buffer_.shift()}else{this.buffer_[0]=this.buffer_[0].subarray(i)}this.bufferSize_-=r.byteLength;var n=[];var a=r.byteLength;for(var s=0;s<a;s++){n.push(String.fromCharCode(r[s]))}var o=d["default"].btoa(n.join(""));d["default"][this.flashEncodedDataName_]=function(){P(t.processBuffer_.bind(t));delete d["default"][t.flashEncodedDataName_];return o};this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_)}},{key:"convertTagsToData_",value:function e(t){var i=0;var r=this.mediaSource_.tech_;var n=0;var a=undefined;var s=[];var o=[];var u=t.tags.videoTags;var f=t.tags.audioTags;if(isNaN(this.basePtsOffset_)&&(u.length||f.length)){var d=u[0]||{pts:Infinity};var l=f[0]||{pts:Infinity};this.basePtsOffset_=Math.min(l.pts,d.pts)}if(r.buffered().length){n=r.buffered().end(0)-this.timestampOffset}if(r.seeking()){n=Math.max(n,r.currentTime()-this.timestampOffset)}n*=1e3;n+=this.basePtsOffset_;for(var c=0;c<f.length;c++){if(f[c].pts>=n){s.push(f[c])}}var h=0;while(h<u.length){var p=u[h];if(p.pts>=n){o.push(p)}else if(p.keyFrame){var m=h+1;var v=false;while(m<u.length){var y=u[m];if(y.pts>=n){break}else if(y.keyFrame){v=true;break}else{m++}}if(v){h=m}else{while(h<m){o.push(u[h]);h++}}continue}h++}var g=this.getOrderedTags_(o,s);if(g.length===0){return}for(var c=0;c<g.length;c++){i+=g[c].bytes.byteLength}a=new Uint8Array(i);for(var c=0,b=0;c<g.length;c++){a.set(g[c].bytes,b);b+=g[c].bytes.byteLength}return a}},{key:"getOrderedTags_",value:function e(t,i){var r=undefined;var n=[];while(t.length||i.length){if(!t.length){r=i.shift()}else if(!i.length){r=t.shift()}else if(i[0].dts<t[0].dts){r=i.shift()}else{r=t.shift()}n.push(r)}return n}}]);return t}(c["default"].EventTarget);i["default"]=x;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./add-text-track-data":42,"./create-text-tracks-if-necessary":45,"./flash-constants":46,"./flash-transmuxer-worker":49,"./remove-cues-from-track":51,"global/window":28,"mux.js/lib/flv":62,webworkify:76}],49:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var s=e("global/window");var o=n(s);var u=e("mux.js/lib/flv");var f=n(u);var d=function e(t){t.on("data",function(e){o["default"].postMessage({action:"data",segment:e})});t.on("done",function(e){o["default"].postMessage({action:"done"})})};var l=function(){function e(t){a(this,e);this.options=t||{};this.init()}r(e,[{key:"init",value:function e(){if(this.transmuxer){this.transmuxer.dispose()}this.transmuxer=new f["default"].Transmuxer(this.options);d(this.transmuxer)}},{key:"push",value:function e(t){var i=new Uint8Array(t.data,t.byteOffset,t.byteLength);this.transmuxer.push(i)}},{key:"reset",value:function e(){this.init()}},{key:"flush",value:function e(){this.transmuxer.flush()}}]);return e}();var c=function e(t){t.onmessage=function(e){if(e.data.action==="init"&&e.data.options){this.messageHandlers=new l(e.data.options);return}if(!this.messageHandlers){this.messageHandlers=new l}if(e.data&&e.data.action&&e.data.action!=="init"){if(this.messageHandlers[e.data.action]){this.messageHandlers[e.data.action](e.data)}}}};i["default"]=function(e){return new c(e)};t.exports=i["default"]},{"global/window":28,"mux.js/lib/flv":62}],50:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var f=e("global/window");var d=s(f);var l=e("global/document");var c=s(l);var h=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var p=s(h);var m=e("./virtual-source-buffer");var v=s(m);var y=e("./add-text-track-data");var g=e("./codec-utils");var b=e("./cleanup-text-tracks");var _=function(e){u(t,e);function t(){var e=this;o(this,t);a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this);var i=undefined;this.nativeMediaSource_=new d["default"].MediaSource;for(i in this.nativeMediaSource_){if(!(i in t.prototype)&&typeof this.nativeMediaSource_[i]==="function"){this[i]=this.nativeMediaSource_[i].bind(this.nativeMediaSource_)}}this.duration_=NaN;Object.defineProperty(this,"duration",{get:function e(){if(this.duration_===Infinity){return this.duration_}return this.nativeMediaSource_.duration},set:function e(t){this.duration_=t;if(t!==Infinity){this.nativeMediaSource_.duration=t;return}}});Object.defineProperty(this,"seekable",{get:function e(){if(this.duration_===Infinity){return p["default"].createTimeRanges([[0,this.nativeMediaSource_.duration]])}return this.nativeMediaSource_.seekable}});Object.defineProperty(this,"readyState",{get:function e(){return this.nativeMediaSource_.readyState}});Object.defineProperty(this,"activeSourceBuffers",{get:function e(){return this.activeSourceBuffers_}});this.sourceBuffers=[];this.activeSourceBuffers_=[];this.updateActiveSourceBuffers_=function(){e.activeSourceBuffers_.length=0;var t=false;var i=true;for(var r=0;r<e.player_.audioTracks().length;r++){var n=e.player_.audioTracks()[r];if(n.enabled&&n.kind!=="main"){t=true;i=false;break}}e.sourceBuffers.forEach(function(r){r.appendAudioInitSegment_=true;if(r.videoCodec_&&r.audioCodec_){r.audioDisabled_=t}else if(r.videoCodec_&&!r.audioCodec_){r.audioDisabled_=true;i=false}else if(!r.videoCodec_&&r.audioCodec_){r.audioDisabled_=i;if(i){return}}e.activeSourceBuffers_.push(r)})};this.onPlayerMediachange_=function(){e.sourceBuffers.forEach(function(e){e.appendAudioInitSegment_=true})};["sourceopen","sourceclose","sourceended"].forEach(function(e){this.nativeMediaSource_.addEventListener(e,this.trigger.bind(this))},this);this.on("sourceopen",function(t){var i=c["default"].querySelector('[src="'+e.url_+'"]');if(!i){return}e.player_=(0,p["default"])(i.parentNode);if(e.player_.audioTracks&&e.player_.audioTracks()){e.player_.audioTracks().on("change",e.updateActiveSourceBuffers_);e.player_.audioTracks().on("addtrack",e.updateActiveSourceBuffers_);e.player_.audioTracks().on("removetrack",e.updateActiveSourceBuffers_)}e.player_.on("mediachange",e.onPlayerMediachange_)});this.on("sourceended",function(t){var i=(0,y.durationOfVideo)(e.duration);for(var r=0;r<e.sourceBuffers.length;r++){var n=e.sourceBuffers[r];var a=n.metadataTrack_&&n.metadataTrack_.cues;if(a&&a.length){a[a.length-1].endTime=i}}});this.on("sourceclose",function(e){this.sourceBuffers.forEach(function(e){if(e.transmuxer_){e.transmuxer_.terminate()}});this.sourceBuffers.length=0;if(!this.player_){return}(0,b.cleanupTextTracks)(this.player_);if(this.player_.audioTracks&&this.player_.audioTracks()){this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_);this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_);this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)}if(this.player_.el_){this.player_.off("mediachange",this.onPlayerMediachange_)}})}n(t,[{key:"addSeekableRange_",value:function e(t,i){var r=undefined;if(this.duration!==Infinity){r=new Error("MediaSource.addSeekableRange() can only be invoked "+"when the duration is Infinity");r.name="InvalidStateError";r.code=11;throw r}if(i>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration)){this.nativeMediaSource_.duration=i}}},{key:"addSourceBuffer",value:function e(t){var i=undefined;var r=(0,g.parseContentType)(t);if(/^(video|audio)\/mp2t$/i.test(r.type)){var n=[];if(r.parameters&&r.parameters.codecs){n=r.parameters.codecs.split(",");n=(0,g.translateLegacyCodecs)(n);n=n.filter(function(e){return(0,g.isAudioCodec)(e)||(0,g.isVideoCodec)(e)})}if(n.length===0){n=["avc1.4d400d","mp4a.40.2"]}i=new v["default"](this,n);if(this.sourceBuffers.length!==0){this.sourceBuffers[0].createRealSourceBuffers_();i.createRealSourceBuffers_();this.sourceBuffers[0].audioDisabled_=true}}else{i=this.nativeMediaSource_.addSourceBuffer(t)}this.sourceBuffers.push(i);return i}}]);return t}(p["default"].EventTarget);i["default"]=_;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./add-text-track-data":42,"./cleanup-text-tracks":43,"./codec-utils":44,"./virtual-source-buffer":54,"global/document":27,"global/window":28}],51:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function e(t,i,r){var n=undefined;var a=undefined;if(!r){return}if(!r.cues){return}n=r.cues.length;while(n--){a=r.cues[n];if(a.startTime<=i&&a.endTime>=t){r.removeCue(a)}}};i["default"]=r;t.exports=i["default"]},{}],52:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:true});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();function n(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var s=e("global/window");var o=n(s);var u=e("mux.js/lib/mp4");var f=n(u);var d=function e(t){t.on("data",function(e){var t=e.initSegment;e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength};var i=e.data;e.data=i.buffer;o["default"].postMessage({action:"data",segment:e,byteOffset:i.byteOffset,byteLength:i.byteLength},[e.data])});if(t.captionStream){t.captionStream.on("data",function(e){o["default"].postMessage({action:"caption",data:e})})}t.on("done",function(e){o["default"].postMessage({action:"done"})})};var l=function(){function e(t){a(this,e);this.options=t||{};this.init()}r(e,[{key:"init",value:function e(){if(this.transmuxer){this.transmuxer.dispose()}this.transmuxer=new f["default"].Transmuxer(this.options);d(this.transmuxer)}},{key:"push",value:function e(t){var i=new Uint8Array(t.data,t.byteOffset,t.byteLength);this.transmuxer.push(i)}},{key:"reset",value:function e(){this.init()}},{key:"setTimestampOffset",value:function e(t){var i=t.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(i*9e4))}},{key:"setAudioAppendStart",value:function e(t){this.transmuxer.setAudioAppendStart(Math.ceil(t.appendStart*9e4))}},{key:"flush",value:function e(t){this.transmuxer.flush()}}]);return e}();var c=function e(t){t.onmessage=function(e){if(e.data.action==="init"&&e.data.options){this.messageHandlers=new l(e.data.options);return}if(!this.messageHandlers){this.messageHandlers=new l}if(e.data&&e.data.action&&e.data.action!=="init"){if(this.messageHandlers[e.data.action]){this.messageHandlers[e.data.action](e.data)}}}};i["default"]=function(e){return new c(e)};t.exports=i["default"]},{"global/window":28,"mux.js/lib/mp4":70}],53:[function(e,t,i){(function(t){"use strict";Object.defineProperty(i,"__esModule",{value:true});function r(e){return e&&e.__esModule?e:{default:e}}var n=e("global/window");var a=r(n);var s=e("./flash-media-source");var o=r(s);var u=e("./html-media-source");var f=r(u);var d=typeof window!=="undefined"?window["videojs"]:typeof t!=="undefined"?t["videojs"]:null;var l=r(d);var c=0;var h={mode:"auto"};l["default"].mediaSources={};var p=function e(t,i){var r=l["default"].mediaSources[t];if(r){r.trigger({type:"sourceopen",swfId:i})}else{throw new Error("Media Source not found (Video.js)")}};var m=function e(){return!!a["default"].MediaSource&&!!a["default"].MediaSource.isTypeSupported&&a["default"].MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')};var v=function e(t){var i=l["default"].mergeOptions(h,t);this.MediaSource={open:p,supportsNativeMediaSources:m};if(i.mode==="html5"||i.mode==="auto"&&m()){return new f["default"]}return new o["default"]};i.MediaSource=v;v.open=p;v.supportsNativeMediaSources=m;var y={createObjectURL:function e(t){var i="blob:vjs-media-source/";var r=undefined;if(t instanceof f["default"]){r=a["default"].URL.createObjectURL(t.nativeMediaSource_);t.url_=r;return r}if(!(t instanceof o["default"])){r=a["default"].URL.createObjectURL(t);t.url_=r;return r}r=i+c;c++;l["default"].mediaSources[r]=t;return r}};i.URL=y;l["default"].MediaSource=v;l["default"].URL=y}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./flash-media-source":47,"./html-media-source":50,"global/window":28}],54:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:true});var n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var a=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function s(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function u(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var f=typeof window!=="undefined"?window["videojs"]:typeof r!=="undefined"?r["videojs"]:null;var d=s(f);var l=e("./create-text-tracks-if-necessary");var c=s(l);var h=e("./remove-cues-from-track");var p=s(h);var m=e("./add-text-track-data");var v=e("webworkify");var y=s(v);var g=e("./transmuxer-worker");var b=s(g);var _=e("./codec-utils");var T=function(e){u(t,e);function t(e,i){var r=this;o(this,t);a(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,d["default"].EventTarget);this.timestampOffset_=0;this.pendingBuffers_=[];this.bufferUpdating_=false;this.mediaSource_=e;this.codecs_=i;this.audioCodec_=null;this.videoCodec_=null;this.audioDisabled_=false;this.appendAudioInitSegment_=true;var n={remux:false};this.codecs_.forEach(function(e){if((0,_.isAudioCodec)(e)){r.audioCodec_=e}else if((0,_.isVideoCodec)(e)){r.videoCodec_=e}});this.transmuxer_=(0,y["default"])(b["default"]);this.transmuxer_.postMessage({action:"init",options:n});this.transmuxer_.onmessage=function(e){if(e.data.action==="data"){return r.data_(e)}if(e.data.action==="done"){return r.done_(e)}};Object.defineProperty(this,"timestampOffset",{get:function e(){return this.timestampOffset_},set:function e(t){if(typeof t==="number"&&t>=0){this.timestampOffset_=t;this.appendAudioInitSegment_=true;this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:t})}}});Object.defineProperty(this,"appendWindowStart",{get:function e(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function e(t){if(this.videoBuffer_){this.videoBuffer_.appendWindowStart=t}if(this.audioBuffer_){this.audioBuffer_.appendWindowStart=t}}});Object.defineProperty(this,"updating",{get:function e(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}});Object.defineProperty(this,"buffered",{get:function e(){var t=null;var i=null;var r=0;var n=[];var a=[];if(!this.videoBuffer_&&!this.audioBuffer_){return d["default"].createTimeRange()}if(!this.videoBuffer_){return this.audioBuffer_.buffered}if(!this.audioBuffer_){return this.videoBuffer_.buffered}if(this.audioDisabled_){return this.videoBuffer_.buffered}if(this.videoBuffer_.buffered.length===0&&this.audioBuffer_.buffered.length===0){return d["default"].createTimeRange()}var s=this.videoBuffer_.buffered;var o=this.audioBuffer_.buffered;var u=s.length;while(u--){n.push({time:s.start(u),type:"start"});n.push({time:s.end(u),type:"end"})}u=o.length;while(u--){n.push({time:o.start(u),type:"start"});n.push({time:o.end(u),type:"end"})}n.sort(function(e,t){return e.time-t.time});for(u=0;u<n.length;u++){if(n[u].type==="start"){r++;if(r===2){t=n[u].time}}else if(n[u].type==="end"){r--;if(r===1){i=n[u].time}}if(t!==null&&i!==null){a.push([t,i]);t=null;i=null}}return d["default"].createTimeRanges(a)}})}n(t,[{key:"data_",value:function e(t){var i=t.data.segment;i.data=new Uint8Array(i.data,t.data.byteOffset,t.data.byteLength);i.initSegment=new Uint8Array(i.initSegment.data,i.initSegment.byteOffset,i.initSegment.byteLength);(0,c["default"])(this,this.mediaSource_,i);this.pendingBuffers_.push(i);return}},{key:"done_",value:function e(t){this.processPendingSegments_();return}},{key:"createRealSourceBuffers_",value:function e(){var t=this;var i=["audio","video"];i.forEach(function(e){if(!t[e+"Codec_"]){return}if(t[e+"Buffer_"]){return}var r=null;if(t.mediaSource_[e+"Buffer_"]){r=t.mediaSource_[e+"Buffer_"]}else{r=t.mediaSource_.nativeMediaSource_.addSourceBuffer(e+'/mp4;codecs="'+t[e+"Codec_"]+'"');t.mediaSource_[e+"Buffer_"]=r}t[e+"Buffer_"]=r;["update","updatestart","updateend"].forEach(function(n){r.addEventListener(n,function(){if(e==="audio"&&t.audioDisabled_){return}var r=i.every(function(i){if(i==="audio"&&t.audioDisabled_){return true}if(e!==i&&t[i+"Buffer_"]&&t[i+"Buffer_"].updating){return false}return true});if(r){return t.trigger(n)}})})})}},{key:"appendBuffer",value:function e(t){this.bufferUpdating_=true;if(this.audioBuffer_&&this.audioBuffer_.buffered.length){var i=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:i.end(i.length-1)})}this.transmuxer_.postMessage({action:"push",data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},[t.buffer]);this.transmuxer_.postMessage({action:"flush"})}},{key:"remove",value:function e(t,i){if(this.videoBuffer_){this.videoBuffer_.remove(t,i)}if(this.audioBuffer_){this.audioBuffer_.remove(t,i)}(0,p["default"])(t,i,this.metadataTrack_);(0,p["default"])(t,i,this.inbandTextTrack_)}},{key:"processPendingSegments_",value:function e(){var t={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]};t=this.pendingBuffers_.reduce(function(e,t){var i=t.type;var r=t.data;var n=t.initSegment;e[i].segments.push(r);e[i].bytes+=r.byteLength;e[i].initSegment=n;if(t.captions){e.captions=e.captions.concat(t.captions)}if(t.info){e[i].info=t.info}if(t.metadata){e.metadata=e.metadata.concat(t.metadata)}return e},t);if(!this.videoBuffer_&&!this.audioBuffer_){if(t.video.bytes===0){this.videoCodec_=null}if(t.audio.bytes===0){this.audioCodec_=null}this.createRealSourceBuffers_()}if(t.audio.info){this.mediaSource_.trigger({type:"audioinfo",info:t.audio.info})}if(t.video.info){this.mediaSource_.trigger({type:"videoinfo",info:t.video.info})}if(this.appendAudioInitSegment_){if(!this.audioDisabled_&&this.audioBuffer_){t.audio.segments.unshift(t.audio.initSegment);t.audio.bytes+=t.audio.initSegment.byteLength}this.appendAudioInitSegment_=false}if(this.videoBuffer_){t.video.segments.unshift(t.video.initSegment);t.video.bytes+=t.video.initSegment.byteLength;this.concatAndAppendSegments_(t.video,this.videoBuffer_);(0,m.addTextTrackData)(this,t.captions,t.metadata)}if(!this.audioDisabled_&&this.audioBuffer_){this.concatAndAppendSegments_(t.audio,this.audioBuffer_)}this.pendingBuffers_.length=0;this.bufferUpdating_=false}},{key:"concatAndAppendSegments_",value:function e(t,i){var r=0;var n=undefined;if(t.bytes){n=new Uint8Array(t.bytes);t.segments.forEach(function(e){n.set(e,r);r+=e.byteLength});try{i.appendBuffer(n)}catch(e){if(this.mediaSource_.player_){this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:e.message,originalError:e})}}}}},{key:"abort",value:function e(){if(this.videoBuffer_){this.videoBuffer_.abort()}if(this.audioBuffer_){this.audioBuffer_.abort()}if(this.transmuxer_){this.transmuxer_.postMessage({action:"reset"})}this.pendingBuffers_.length=0;this.bufferUpdating_=false}}]);return t}(d["default"].EventTarget);i["default"]=T;t.exports=i["default"]}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./add-text-track-data":42,"./codec-utils":44,"./create-text-tracks-if-necessary":45,"./remove-cues-from-track":51,"./transmuxer-worker":52,webworkify:76}],55:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n;n=function(){var e=new Uint8Array,t=0;n.prototype.init.call(this);this.setTimestamp=function(e){t=e};this.parseId3TagSize=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=e[t+5],n=(r&16)>>4;if(n){return i+20}return i+10};this.parseAdtsSize=function(e,t){var i=(e[t+5]&224)>>5,r=e[t+4]<<3,n=e[t+3]&3<<11;return n|r|i};this.push=function(i){var r=0,n=0,a,s,o,u;if(e.length){u=e.length;e=new Uint8Array(i.byteLength+u);e.set(e.subarray(0,u));e.set(i,u)}else{e=i}while(e.length-n>=3){if(e[n]==="I".charCodeAt(0)&&e[n+1]==="D".charCodeAt(0)&&e[n+2]==="3".charCodeAt(0)){if(e.length-n<10){break}r=this.parseId3TagSize(e,n);if(r>e.length){break}s={type:"timed-metadata",data:e.subarray(n,n+r)};this.trigger("data",s);n+=r;continue}else if(e[n]&255===255&&(e[n+1]&240)===240){if(e.length-n<7){break}r=this.parseAdtsSize(e,n);if(r>e.length){break}o={type:"audio",data:e.subarray(n,n+r),pts:t,dts:t};this.trigger("data",o);n+=r;continue}n++}a=e.length-n;if(a>0){e=e.subarray(n)}else{e=new Uint8Array}}};n.prototype=new r;t.exports=n},{"../utils/stream.js":75}],56:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n;var a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=function(){var e;n.prototype.init.call(this);this.push=function(t){var i=0,r=0,n,s,o,u,f,d;if(t.type!=="audio"){return}if(e){u=e;e=new Uint8Array(u.byteLength+t.data.byteLength);e.set(u);e.set(t.data,u.byteLength)}else{e=t.data}while(i+5<e.length){if(e[i]!==255||(e[i+1]&246)!==240){i++;continue}s=(~e[i+1]&1)*2;n=(e[i+3]&3)<<11|e[i+4]<<3|(e[i+5]&224)>>5;f=((e[i+6]&3)+1)*1024;d=f*9e4/a[(e[i+2]&60)>>>2];o=i+n;if(e.byteLength<o){return}this.trigger("data",{pts:t.pts+r*d,dts:t.dts+r*d,sampleCount:f,audioobjecttype:(e[i+2]>>>6&3)+1,channelcount:(e[i+2]&1)<<2|(e[i+3]&192)>>>6,samplerate:a[(e[i+2]&60)>>>2],samplingfrequencyindex:(e[i+2]&60)>>>2,samplesize:16,data:e.subarray(i+7+s,o)});if(e.byteLength===o){e=undefined;return}r++;e=e.subarray(o)}};this.flush=function(){this.trigger("done")}};n.prototype=new r;t.exports=n},{"../utils/stream.js":75}],57:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n=e("../utils/exp-golomb.js");var a,s;var o;s=function(){var e=0,t,i;s.prototype.init.call(this);this.push=function(r){var n;if(!i){i=r.data}else{n=new Uint8Array(i.byteLength+r.data.byteLength);n.set(i);n.set(r.data,i.byteLength);i=n}for(;e<i.byteLength-3;e++){if(i[e+2]===1){t=e+5;break}}while(t<i.byteLength){switch(i[t]){case 0:if(i[t-1]!==0){t+=2;break}else if(i[t-2]!==0){t++;break}if(e+3!==t-2){this.trigger("data",i.subarray(e+3,t-2))}do{t++}while(i[t]!==1&&t<i.length);e=t-2;t+=3;break;case 1:if(i[t-1]!==0||i[t-2]!==0){t+=3;break}this.trigger("data",i.subarray(e+3,t-2));e=t-2;t+=3;break;default:t+=3;break}}i=i.subarray(e);t-=e;e=0};this.flush=function(){if(i&&i.byteLength>3){this.trigger("data",i.subarray(e+3))}i=null;e=0;this.trigger("done")}};s.prototype=new r;o={100:true,110:true,122:true,244:true,44:true,83:true,86:true,118:true,128:true,138:true,139:true,134:true};a=function(){var e=new s,t,i,r,u,f,d,l;a.prototype.init.call(this);t=this;this.push=function(t){if(t.type!=="video"){return}i=t.trackId;r=t.pts;u=t.dts;e.push(t)};e.on("data",function(e){var n={trackId:i,pts:r,dts:u,data:e};switch(e[0]&31){case 5:n.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:n.nalUnitType="sei_rbsp";n.escapedRBSP=f(e.subarray(1));break;case 7:n.nalUnitType="seq_parameter_set_rbsp";n.escapedRBSP=f(e.subarray(1));n.config=d(n.escapedRBSP);break;case 8:n.nalUnitType="pic_parameter_set_rbsp";break;case 9:n.nalUnitType="access_unit_delimiter_rbsp";break;default:break}t.trigger("data",n)});e.on("done",function(){t.trigger("done")});this.flush=function(){e.flush()};l=function(e,t){var i=8,r=8,n,a;for(n=0;n<e;n++){if(r!==0){a=t.readExpGolomb();r=(i+a+256)%256}i=r===0?i:r}};f=function(e){var t=e.byteLength,i=[],r=1,n,a;while(r<t-2){if(e[r]===0&&e[r+1]===0&&e[r+2]===3){i.push(r+2);r+=2}else{r++}}if(i.length===0){return e}n=t-i.length;a=new Uint8Array(n);var s=0;for(r=0;r<n;s++,r++){if(s===i[0]){s++;i.shift()}a[r]=e[s]}return a};d=function(e){var t=0,i=0,r=0,a=0,s=1,u,f,d,c,h,p,m,v,y,g,b,_,T,w;u=new n(e);f=u.readUnsignedByte();c=u.readUnsignedByte();d=u.readUnsignedByte();u.skipUnsignedExpGolomb();if(o[f]){h=u.readUnsignedExpGolomb();if(h===3){u.skipBits(1)}u.skipUnsignedExpGolomb();u.skipUnsignedExpGolomb();u.skipBits(1);if(u.readBoolean()){b=h!==3?8:12;for(w=0;w<b;w++){if(u.readBoolean()){if(w<6){l(16,u)}else{l(64,u)}}}}}u.skipUnsignedExpGolomb();p=u.readUnsignedExpGolomb();if(p===0){u.readUnsignedExpGolomb()}else if(p===1){u.skipBits(1);u.skipExpGolomb();u.skipExpGolomb();m=u.readUnsignedExpGolomb();for(w=0;w<m;w++){u.skipExpGolomb()}}u.skipUnsignedExpGolomb();u.skipBits(1);v=u.readUnsignedExpGolomb();y=u.readUnsignedExpGolomb();g=u.readBits(1);if(g===0){u.skipBits(1)}u.skipBits(1);if(u.readBoolean()){t=u.readUnsignedExpGolomb();i=u.readUnsignedExpGolomb();r=u.readUnsignedExpGolomb();a=u.readUnsignedExpGolomb()}if(u.readBoolean()){if(u.readBoolean()){T=u.readUnsignedByte();switch(T){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[u.readUnsignedByte()<<8|u.readUnsignedByte(),u.readUnsignedByte()<<8|u.readUnsignedByte()];break}}if(_){s=_[0]/_[1]}}}return{profileIdc:f,levelIdc:d,profileCompatibility:c,width:Math.ceil(((v+1)*16-t*2-i*2)*s),height:(2-g)*(y+1)*16-r*2-a*2}}};a.prototype=new r;t.exports={H264Stream:a,NalByteStream:s}},{"../utils/exp-golomb.js":74,"../utils/stream.js":75}],58:[function(e,t,i){var r=[33,16,5,32,164,27];var n=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252];var a=function(e){var t=[];while(e--){t.push(0)}return t};var s=function(e){return Object.keys(e).reduce(function(t,i){t[i]=new Uint8Array(e[i].reduce(function(e,t){return e.concat(t)},[]));return t},{})};var o={96e3:[r,[227,64],a(154),[56]],88200:[r,[231],a(170),[56]],64e3:[r,[248,192],a(240),[56]],48e3:[r,[255,192],a(268),[55,148,128],a(54),[112]],44100:[r,[255,192],a(268),[55,163,128],a(84),[112]],32e3:[r,[255,192],a(268),[55,234],a(226),[112]],24e3:[r,[255,192],a(268),[55,255,128],a(268),[111,112],a(126),[224]],16e3:[r,[255,192],a(268),[55,255,128],a(268),[111,255],a(269),[223,108],a(195),[1,192]],12e3:[n,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,253,128],a(259),[56]],11025:[n,a(268),[3,127,248],a(268),[6,255,240],a(268),[13,255,224],a(268),[27,255,192],a(268),[55,175,128],a(108),[112]],8e3:[n,a(268),[3,121,16],a(47),[7]]};t.exports=s(o)},{}],59:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n=function(e){this.numberOfTracks=0;this.metadataStream=e.metadataStream;this.videoTags=[];this.audioTags=[];this.videoTrack=null;this.audioTrack=null;this.pendingCaptions=[];this.pendingMetadata=[];this.pendingTracks=0;this.processedTracks=0;n.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}if(e.track.type==="video"){this.videoTrack=e.track;this.videoTags=e.tags;this.pendingTracks++}if(e.track.type==="audio"){this.audioTrack=e.track;this.audioTags=e.tags;this.pendingTracks++}}};n.prototype=new r;n.prototype.flush=function(e){var t,i,r,n,a={tags:{},captions:[],metadata:[]};if(this.pendingTracks<this.numberOfTracks){if(e!=="VideoSegmentStream"&&e!=="AudioSegmentStream"){return}else if(this.pendingTracks===0){this.processedTracks++;if(this.processedTracks<this.numberOfTracks){return}}}this.processedTracks+=this.pendingTracks;this.pendingTracks=0;if(this.processedTracks<this.numberOfTracks){return}if(this.videoTrack){n=this.videoTrack.timelineStartInfo.pts}else if(this.audioTrack){n=this.audioTrack.timelineStartInfo.pts}a.tags.videoTags=this.videoTags;a.tags.audioTags=this.audioTags;for(r=0;r<this.pendingCaptions.length;r++){i=this.pendingCaptions[r];i.startTime=i.startPts-n;i.startTime/=9e4;i.endTime=i.endPts-n;i.endTime/=9e4;a.captions.push(i)}for(r=0;r<this.pendingMetadata.length;r++){t=this.pendingMetadata[r];t.cueTime=t.pts-n;t.cueTime/=9e4;a.metadata.push(t)}a.metadata.dispatchType=this.metadataStream.dispatchType;this.videoTrack=null;this.audioTrack=null;this.videoTags=[];this.audioTags=[];this.pendingCaptions.length=0;this.pendingMetadata.length=0;this.pendingTracks=0;this.processedTracks=0;this.trigger("data",a);this.trigger("done")};t.exports=n},{"../utils/stream.js":75}],60:[function(e,t,i){"use strict";var r=e("./flv-tag.js");var n=function(e,t,i){var n=new Uint8Array(3+1+1+4),a=new DataView(n.buffer),s,o,u;e=e||0;t=t===undefined?true:t;i=i===undefined?true:i;a.setUint8(0,70);a.setUint8(1,76);a.setUint8(2,86);a.setUint8(3,1);a.setUint8(4,(t?4:0)|(i?1:0));a.setUint32(5,n.byteLength);if(e<=0){o=new Uint8Array(n.byteLength+4);o.set(n);o.set([0,0,0,0],n.byteLength);return o}s=new r(r.METADATA_TAG);s.pts=s.dts=0;s.writeMetaDataDouble("duration",e);u=s.finalize().length;o=new Uint8Array(n.byteLength+u);o.set(n);o.set(a.byteLength,u);return o};t.exports=n},{"./flv-tag.js":61}],61:[function(e,t,i){"use strict";var r;r=function(e,t){var i=0,n=16384,a=function(e,t){var i,r=e.position+t;if(r<e.bytes.byteLength){return}i=new Uint8Array(r*2);i.set(e.bytes.subarray(0,e.position),0);e.bytes=i;e.view=new DataView(e.bytes.buffer)},s=r.widthBytes||new Uint8Array("width".length),o=r.heightBytes||new Uint8Array("height".length),u=r.videocodecidBytes||new Uint8Array("videocodecid".length),f;if(!r.widthBytes){for(f=0;f<"width".length;f++){s[f]="width".charCodeAt(f)}for(f=0;f<"height".length;f++){o[f]="height".charCodeAt(f)}for(f=0;f<"videocodecid".length;f++){u[f]="videocodecid".charCodeAt(f)}r.widthBytes=s;r.heightBytes=o;r.videocodecidBytes=u}this.keyFrame=false;switch(e){case r.VIDEO_TAG:this.length=16;n*=6;break;case r.AUDIO_TAG:this.length=13;this.keyFrame=true;break;case r.METADATA_TAG:this.length=29;this.keyFrame=true;break;default:throw new Error("Unknown FLV tag type")}this.bytes=new Uint8Array(n);this.view=new DataView(this.bytes.buffer);this.bytes[0]=e;this.position=this.length;this.keyFrame=t;this.pts=0;this.dts=0;this.writeBytes=function(e,t,i){var r=t||0,n;i=i||e.byteLength;n=r+i;a(this,i);this.bytes.set(e.subarray(r,n),this.position);this.position+=i;this.length=Math.max(this.length,this.position)};this.writeByte=function(e){a(this,1);this.bytes[this.position]=e;this.position++;this.length=Math.max(this.length,this.position)};this.writeShort=function(e){a(this,2);this.view.setUint16(this.position,e);this.position+=2;this.length=Math.max(this.length,this.position)};this.negIndex=function(e){return this.bytes[this.length-e]};this.nalUnitSize=function(){if(i===0){return 0}return this.length-(i+4)};this.startNalUnit=function(){if(i>0){throw new Error("Attempted to create new NAL wihout closing the old one")}i=this.length;this.length+=4;this.position=this.length};this.endNalUnit=function(e){var t,r;if(this.length===i+4){this.length-=4}else if(i>0){t=i+4;r=this.length-t;this.position=i;this.view.setUint32(this.position,r);this.position=this.length;if(e){e.push(this.bytes.subarray(t,t+r))}}i=0};this.writeMetaDataDouble=function(e,t){var r;a(this,2+e.length+9);this.view.setUint16(this.position,e.length);this.position+=2;if(e==="width"){this.bytes.set(s,this.position);this.position+=5}else if(e==="height"){this.bytes.set(o,this.position);this.position+=6}else if(e==="videocodecid"){this.bytes.set(u,this.position);this.position+=12}else{for(r=0;r<e.length;r++){this.bytes[this.position]=e.charCodeAt(r);this.position++}}this.position++;this.view.setFloat64(this.position,t);this.position+=8;this.length=Math.max(this.length,this.position);++i};this.writeMetaDataBoolean=function(e,t){var r;a(this,2);this.view.setUint16(this.position,e.length);this.position+=2;for(r=0;r<e.length;r++){a(this,1);this.bytes[this.position]=e.charCodeAt(r);this.position++}a(this,2);this.view.setUint8(this.position,1);this.position++;this.view.setUint8(this.position,t?1:0);this.position++;this.length=Math.max(this.length,this.position);++i};this.finalize=function(){var e,n;switch(this.bytes[0]){case r.VIDEO_TAG:this.bytes[11]=(this.keyFrame||t?16:32)|7;this.bytes[12]=t?0:1;e=this.pts-this.dts;this.bytes[13]=(e&16711680)>>>16;this.bytes[14]=(e&65280)>>>8;this.bytes[15]=(e&255)>>>0;break;case r.AUDIO_TAG:this.bytes[11]=175;this.bytes[12]=t?0:1;break;case r.METADATA_TAG:this.position=11;this.view.setUint8(this.position,2);this.position++;this.view.setUint16(this.position,10);this.position+=2;this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position);this.position+=10;this.bytes[this.position]=8;this.position++;this.view.setUint32(this.position,i);this.position=this.length;this.bytes.set([0,0,9],this.position);this.position+=3;this.length=this.position;break}n=this.length-11;this.bytes[1]=(n&16711680)>>>16;this.bytes[2]=(n&65280)>>>8;this.bytes[3]=(n&255)>>>0;this.bytes[4]=(this.dts&16711680)>>>16;this.bytes[5]=(this.dts&65280)>>>8;this.bytes[6]=(this.dts&255)>>>0;this.bytes[7]=(this.dts&4278190080)>>>24;this.bytes[8]=0;this.bytes[9]=0;this.bytes[10]=0;a(this,4);this.view.setUint32(this.length,this.length);this.length+=4;this.position+=4;this.bytes=this.bytes.subarray(0,this.length);this.frameTime=r.frameTime(this.bytes);return this}};r.AUDIO_TAG=8;r.VIDEO_TAG=9;r.METADATA_TAG=18;r.isAudioFrame=function(e){return r.AUDIO_TAG===e[0]};r.isVideoFrame=function(e){return r.VIDEO_TAG===e[0]};r.isMetaData=function(e){return r.METADATA_TAG===e[0]};r.isKeyFrame=function(e){if(r.isVideoFrame(e)){return e[11]===23}if(r.isAudioFrame(e)){return true}if(r.isMetaData(e)){return true}return false};r.frameTime=function(e){var t=e[4]<<16;t|=e[5]<<8;t|=e[6]<<0;t|=e[7]<<24;return t};t.exports=r},{}],62:[function(e,t,i){t.exports={tag:e("./flv-tag"),Transmuxer:e("./transmuxer"),getFlvHeader:e("./flv-header")}},{"./flv-header":60,"./flv-tag":61,"./transmuxer":64}],63:[function(e,t,i){"use strict";var r=function(){var e=this;this.list=[];this.push=function(e){this.list.push({bytes:e.bytes,dts:e.dts,pts:e.pts})};Object.defineProperty(this,"length",{get:function(){return e.list.length}})};t.exports=r},{}],64:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n=e("./flv-tag.js");var a=e("../m2ts/m2ts.js");var s=e("../codecs/adts.js");var o=e("../codecs/h264").H264Stream;var u=e("./coalesce-stream.js");var f=e("./tag-list.js");var d,l,c,h,p,m;h=function(e,t){if(typeof t.pts==="number"){if(e.timelineStartInfo.pts===undefined){e.timelineStartInfo.pts=t.pts}else{e.timelineStartInfo.pts=Math.min(e.timelineStartInfo.pts,t.pts)}}if(typeof t.dts==="number"){if(e.timelineStartInfo.dts===undefined){e.timelineStartInfo.dts=t.dts}else{e.timelineStartInfo.dts=Math.min(e.timelineStartInfo.dts,t.dts)}}};p=function(e,t){var i=new n(n.METADATA_TAG);i.dts=t;i.pts=t;i.writeMetaDataDouble("videocodecid",7);i.writeMetaDataDouble("width",e.width);i.writeMetaDataDouble("height",e.height);return i};m=function(e,t){var i,r=new n(n.VIDEO_TAG,true);r.dts=t;r.pts=t;r.writeByte(1);r.writeByte(e.profileIdc);r.writeByte(e.profileCompatibility);r.writeByte(e.levelIdc);r.writeByte(252|3);r.writeByte(224|1);r.writeShort(e.sps[0].length);r.writeBytes(e.sps[0]);r.writeByte(e.pps.length);for(i=0;i<e.pps.length;++i){r.writeShort(e.pps[i].length);r.writeBytes(e.pps[i])}return r};c=function(e){var t=[],i;c.prototype.init.call(this);this.push=function(i){h(e,i);if(e&&e.channelcount===undefined){e.audioobjecttype=i.audioobjecttype;e.channelcount=i.channelcount;e.samplerate=i.samplerate;e.samplingfrequencyindex=i.samplingfrequencyindex;e.samplesize=i.samplesize;e.extraData=e.audioobjecttype<<11|e.samplingfrequencyindex<<7|e.channelcount<<3}i.pts=Math.round(i.pts/90);i.dts=Math.round(i.dts/90);t.push(i)};this.flush=function(){var r,a,s,o=new f;if(t.length===0){this.trigger("done","AudioSegmentStream");return}s=-Infinity;while(t.length){r=t.shift();if(e.extraData!==i||r.pts-s>=1e3){a=new n(n.METADATA_TAG);a.pts=r.pts;a.dts=r.dts;a.writeMetaDataDouble("audiocodecid",10);a.writeMetaDataBoolean("stereo",e.channelcount===2);a.writeMetaDataDouble("audiosamplerate",e.samplerate);a.writeMetaDataDouble("audiosamplesize",16);o.push(a.finalize());i=e.extraData;a=new n(n.AUDIO_TAG,true);a.pts=r.pts;a.dts=r.dts;a.view.setUint16(a.position,e.extraData);a.position+=2;a.length=Math.max(a.length,a.position);o.push(a.finalize());s=r.pts}a=new n(n.AUDIO_TAG);a.pts=r.pts;a.dts=r.dts;a.writeBytes(r.data);o.push(a.finalize())}i=null;this.trigger("data",{track:e,tags:o.list});this.trigger("done","AudioSegmentStream")}};c.prototype=new r;l=function(e){var t=[],i,r;l.prototype.init.call(this);this.finishFrame=function(t,n){if(!n){return}if(i&&e&&e.newMetadata&&(n.keyFrame||t.length===0)){t.push(p(i,n.dts).finalize());t.push(m(e,n.dts).finalize());e.newMetadata=false}n.endNalUnit();t.push(n.finalize());r=null};this.push=function(i){h(e,i);i.pts=Math.round(i.pts/90);i.dts=Math.round(i.dts/90);t.push(i)};this.flush=function(){var a,s=new f;while(t.length){if(t[0].nalUnitType==="access_unit_delimiter_rbsp"){break}t.shift()}if(t.length===0){this.trigger("done","VideoSegmentStream");return}while(t.length){a=t.shift();if(a.nalUnitType==="seq_parameter_set_rbsp"){e.newMetadata=true;i=a.config;e.width=i.width;e.height=i.height;e.sps=[a.data];e.profileIdc=i.profileIdc;e.levelIdc=i.levelIdc;e.profileCompatibility=i.profileCompatibility;r.endNalUnit()}else if(a.nalUnitType==="pic_parameter_set_rbsp"){e.newMetadata=true;e.pps=[a.data];r.endNalUnit()}else if(a.nalUnitType==="access_unit_delimiter_rbsp"){if(r){this.finishFrame(s,r)}r=new n(n.VIDEO_TAG);r.pts=a.pts;r.dts=a.dts}else{if(a.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"){r.keyFrame=true}r.endNalUnit()}r.startNalUnit();r.writeBytes(a.data)}if(r){this.finishFrame(s,r)}this.trigger("data",{track:e,tags:s.list});this.trigger("done","VideoSegmentStream")}};l.prototype=new r;d=function(e){var t=this,i,r,n,f,h,p,m,v,y,g,b,_;d.prototype.init.call(this);e=e||{};this.metadataStream=new a.MetadataStream;e.metadataStream=this.metadataStream;i=new a.TransportPacketStream;r=new a.TransportParseStream;n=new a.ElementaryStream;f=new a.TimestampRolloverStream("video");h=new a.TimestampRolloverStream("audio");p=new a.TimestampRolloverStream("timed-metadata");m=new s;v=new o;_=new u(e);i.pipe(r).pipe(n);n.pipe(f).pipe(v);n.pipe(h).pipe(m);n.pipe(p).pipe(this.metadataStream).pipe(_);b=new a.CaptionStream;v.pipe(b).pipe(_);n.on("data",function(e){var t,i,r;if(e.type==="metadata"){t=e.tracks.length;while(t--){if(e.tracks[t].type==="video"){i=e.tracks[t]}else if(e.tracks[t].type==="audio"){r=e.tracks[t]}}if(i&&!y){_.numberOfTracks++;y=new l(i);v.pipe(y).pipe(_)}if(r&&!g){_.numberOfTracks++;g=new c(r);m.pipe(g).pipe(_)}}});this.push=function(e){i.push(e)};this.flush=function(){i.flush()};_.on("data",function(e){t.trigger("data",e)});_.on("done",function(){t.trigger("done")})};d.prototype=new r;t.exports=d},{"../codecs/adts.js":56,"../codecs/h264":57,"../m2ts/m2ts.js":66,"../utils/stream.js":75,"./coalesce-stream.js":59,"./flv-tag.js":61,"./tag-list.js":63}],65:[function(e,t,i){"use strict";var r=4,n=128,a=e("../utils/stream");var s=function(e){var t=0,i={payloadType:-1,payloadSize:0},a=0,s=0;while(t<e.byteLength){if(e[t]===n){break}while(e[t]===255){a+=255;t++}a+=e[t++];while(e[t]===255){s+=255;t++}s+=e[t++];if(!i.payload&&a===r){i.payloadType=a;i.payloadSize=s;i.payload=e.subarray(t,t+s);break}t+=s;a=0;s=0}return i};var o=function(e){if(e.payload[0]!==181){return null}if((e.payload[1]<<8|e.payload[2])!==49){return null}if(String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])!=="GA94"){return null}if(e.payload[7]!==3){return null}return e.payload.subarray(8,e.payload.length-1)};var u=function(e,t){var i=[],r,n,a,s;if(!(t[0]&64)){return i}n=t[0]&31;for(r=0;r<n;r++){a=r*3;s={type:t[a+2]&3,pts:e};if(t[a+2]&4){s.ccData=t[a+3]<<8|t[a+4];i.push(s)}}return i};var f=function(){f.prototype.init.call(this);this.captionPackets_=[];this.field1_=new k;this.field1_.on("data",this.trigger.bind(this,"data"));this.field1_.on("done",this.trigger.bind(this,"done"))};f.prototype=new a;f.prototype.push=function(e){var t,i;if(e.nalUnitType!=="sei_rbsp"){return}t=s(e.escapedRBSP);if(t.payloadType!==r){return}i=o(t);if(!i){return}this.captionPackets_=this.captionPackets_.concat(u(e.pts,i))};f.prototype.flush=function(){if(!this.captionPackets_.length){this.field1_.flush();return}this.captionPackets_.forEach(function(e,t){e.presortIndex=t});this.captionPackets_.sort(function(e,t){if(e.pts===t.pts){return e.presortIndex-t.presortIndex}return e.pts-t.pts});this.captionPackets_.forEach(this.field1_.push,this.field1_);this.captionPackets_.length=0;this.field1_.flush();return};var d={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608};var l=function(e){if(e===null){return""}e=d[e]||e;return String.fromCharCode(e)};var c=0,h=5152,p=5167,m=5157,v=5158,y=5159,g=5165,b=5153,_=5164,T=5166;var w=14;var S=function(){var e=[],t=w+1;while(t--){e.push("")}return e};var k=function(){k.prototype.init.call(this);this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=S();this.nonDisplayed_=S();this.lastControlCode_=null;this.push=function(e){if(e.type!==0){return}var t,i,r,n;t=e.ccData&32639;if(t===this.lastControlCode_){this.lastControlCode_=null;return}if((t&61440)===4096){this.lastControlCode_=t}else{this.lastControlCode_=null}switch(t){case c:break;case h:this.mode_="popOn";break;case p:this.flushDisplayed(e.pts);i=this.displayed_;this.displayed_=this.nonDisplayed_;this.nonDisplayed_=i;this.startPts_=e.pts;break;case m:this.topRow_=w-1;this.mode_="rollUp";break;case v:this.topRow_=w-2;this.mode_="rollUp";break;case y:this.topRow_=w-3;this.mode_="rollUp";break;case g:this.flushDisplayed(e.pts);this.shiftRowsUp_();this.startPts_=e.pts;break;case b:if(this.mode_==="popOn"){this.nonDisplayed_[w]=this.nonDisplayed_[w].slice(0,-1)}else{this.displayed_[w]=this.displayed_[w].slice(0,-1)}break;case _:this.flushDisplayed(e.pts);this.displayed_=S();break;case T:this.nonDisplayed_=S();break;default:r=t>>>8;n=t&255;if(r>=16&&r<=23&&n>=64&&n<=127&&(r!==16||n<96)){r=32;n=null}if((r===17||r===25)&&(n>=48&&n<=63)){r=9834;n=""}if((r&240)===16){return}if(r===0){r=null}if(n===0){n=null}this[this.mode_](e.pts,r,n);break}}};k.prototype=new a;k.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e){return e.trim()}).filter(function(e){return e.length}).join("\n");if(t.length){this.trigger("data",{startPts:this.startPts_,endPts:e,text:t})}};k.prototype.popOn=function(e,t,i){var r=this.nonDisplayed_[w];r+=l(t);r+=l(i);this.nonDisplayed_[w]=r};k.prototype.rollUp=function(e,t,i){var r=this.displayed_[w];if(r===""){this.flushDisplayed(e);this.startPts_=e}r+=l(t);r+=l(i);this.displayed_[w]=r};k.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++){this.displayed_[e]=""}for(e=this.topRow_;e<w;e++){this.displayed_[e]=this.displayed_[e+1]}this.displayed_[w]=""};t.exports={CaptionStream:f,Cea608Stream:k}},{"../utils/stream":75}],66:[function(e,t,i){"use strict";var r=e("../utils/stream.js"),n=e("./caption-stream"),a=e("./stream-types"),s=e("./timestamp-rollover-stream").TimestampRolloverStream;var o=e("./stream-types.js");var u,f,d;var l=188,c=71;u=function(){var e=new Uint8Array(l),t=0;u.prototype.init.call(this);this.push=function(i){var r=0,n=l,a;if(t){a=new Uint8Array(i.byteLength+t);a.set(e.subarray(0,t));a.set(i,t);t=0}else{a=i}while(n<a.byteLength){if(a[r]===c&&a[n]===c){this.trigger("data",a.subarray(r,n));r+=l;n+=l;continue}r++;n++}if(r<a.byteLength){e.set(a.subarray(r),0);t=a.byteLength-r}};this.flush=function(){if(t===l&&e[0]===c){this.trigger("data",e);t=0}this.trigger("done")}};u.prototype=new r;f=function(){var e,t,i,r;f.prototype.init.call(this);r=this;this.packetsWaitingForPmt=[];this.programMapTable=undefined;e=function(e,r){var n=0;if(r.payloadUnitStartIndicator){n+=e[n]+1}if(r.type==="pat"){t(e.subarray(n),r)}else{i(e.subarray(n),r)}};t=function(e,t){t.section_number=e[7];t.last_section_number=e[8];r.pmtPid=(e[10]&31)<<8|e[11];t.pmtPid=r.pmtPid};i=function(e,t){var i,n,a,s;if(!(e[5]&1)){return}r.programMapTable={};i=(e[1]&15)<<8|e[2];n=3+i-4;a=(e[10]&15)<<8|e[11];s=12+a;while(s<n){r.programMapTable[(e[s+1]&31)<<8|e[s+2]]=e[s];s+=((e[s+3]&15)<<8|e[s+4])+5}t.programMapTable=r.programMapTable;while(r.packetsWaitingForPmt.length){r.processPes_.apply(r,r.packetsWaitingForPmt.shift())}};this.push=function(t){var i={},r=4;i.payloadUnitStartIndicator=!!(t[1]&64);i.pid=t[1]&31;i.pid<<=8;i.pid|=t[2];if((t[3]&48)>>>4>1){r+=t[r]+1}if(i.pid===0){i.type="pat";e(t.subarray(r),i);this.trigger("data",i)}else if(i.pid===this.pmtPid){i.type="pmt";e(t.subarray(r),i);this.trigger("data",i)}else if(this.programMapTable===undefined){this.packetsWaitingForPmt.push([t,r,i])}else{this.processPes_(t,r,i)}};this.processPes_=function(e,t,i){i.streamType=this.programMapTable[i.pid];i.type="pes";i.data=e.subarray(t);this.trigger("data",i)}};f.prototype=new r;f.STREAM_TYPES={h264:27,adts:15};d=function(){var e=this,t={data:[],size:0},i={data:[],size:0},r={data:[],size:0},n=function(e,t){var i;t.dataAlignmentIndicator=(e[6]&4)!==0;i=e[7];if(i&192){t.pts=(e[9]&14)<<27|(e[10]&255)<<20|(e[11]&254)<<12|(e[12]&255)<<5|(e[13]&254)>>>3;t.pts*=4;t.pts+=(e[13]&6)>>>1;t.dts=t.pts;if(i&64){t.dts=(e[14]&14)<<27|(e[15]&255)<<20|(e[16]&254)<<12|(e[17]&255)<<5|(e[18]&254)>>>3;t.dts*=4;t.dts+=(e[18]&6)>>>1}}t.data=e.subarray(9+e[8])},s=function(t,i){var r=new Uint8Array(t.size),a={type:i},s=0,o;if(!t.data.length){return}a.trackId=t.data[0].pid;while(t.data.length){o=t.data.shift();r.set(o.data,s);s+=o.data.byteLength}n(r,a);t.size=0;e.trigger("data",a)};d.prototype.init.call(this);this.push=function(n){({pat:function(){},pes:function(){var e,u;switch(n.streamType){case a.H264_STREAM_TYPE:case o.H264_STREAM_TYPE:e=t;u="video";break;case a.ADTS_STREAM_TYPE:e=i;u="audio";break;case a.METADATA_STREAM_TYPE:e=r;u="timed-metadata";break;default:return}if(n.payloadUnitStartIndicator){s(e,u)}e.data.push(n);e.size+=n.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]},i=n.programMapTable,r,a;for(r in i){if(i.hasOwnProperty(r)){a={timelineStartInfo:{baseMediaDecodeTime:0}};a.id=+r;if(i[r]===o.H264_STREAM_TYPE){a.codec="avc";a.type="video"}else if(i[r]===o.ADTS_STREAM_TYPE){a.codec="adts";a.type="audio"}t.tracks.push(a)}}e.trigger("data",t)}})[n.type]()};this.flush=function(){s(t,"video");s(i,"audio");s(r,"timed-metadata");this.trigger("done")}};d.prototype=new r;var h={PAT_PID:0,MP2T_PACKET_LENGTH:l,TransportPacketStream:u,TransportParseStream:f,ElementaryStream:d,TimestampRolloverStream:s,CaptionStream:n.CaptionStream,Cea608Stream:n.Cea608Stream,MetadataStream:e("./metadata-stream")};for(var p in a){if(a.hasOwnProperty(p)){h[p]=a[p]}}t.exports=h},{"../utils/stream.js":75,"./caption-stream":65,"./metadata-stream":67,"./stream-types":68,"./stream-types.js":68,"./timestamp-rollover-stream":69}],67:[function(e,t,i){"use strict";var r=e("../utils/stream"),n=e("./stream-types"),a=function(e,t,i){var r,n="";for(r=t;r<i;r++){n+="%"+("00"+e[r].toString(16)).slice(-2)}return n},s=function(e,t,i){return decodeURIComponent(a(e,t,i))},o=function(e,t,i){return unescape(a(e,t,i))},u=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},f={TXXX:function(e){var t;if(e.data[0]!==3){return}for(t=1;t<e.data.length;t++){if(e.data[t]===0){e.description=s(e.data,1,t);e.value=s(e.data,t+1,e.data.length-1);break}}e.data=e.value},WXXX:function(e){var t;if(e.data[0]!==3){return}for(t=1;t<e.data.length;t++){if(e.data[t]===0){e.description=s(e.data,1,t);e.url=s(e.data,t+1,e.data.length);break}}},PRIV:function(e){var t;for(t=0;t<e.data.length;t++){if(e.data[t]===0){e.owner=o(e.data,0,t);break}}e.privateData=e.data.subarray(t+1);e.data=e.privateData}},d;d=function(e){var t={debug:!!(e&&e.debug),descriptor:e&&e.descriptor},i=0,r=[],a=0,s;d.prototype.init.call(this);this.dispatchType=n.METADATA_STREAM_TYPE.toString(16);if(t.descriptor){for(s=0;s<t.descriptor.length;s++){this.dispatchType+=("00"+t.descriptor[s].toString(16)).slice(-2)}}this.push=function(e){var n,s,o,d,l,c;if(e.type!=="timed-metadata"){return}if(e.dataAlignmentIndicator){a=0;r.length=0}if(r.length===0&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0))){if(t.debug){console.log("Skipping unrecognized metadata packet")}return}r.push(e);a+=e.data.byteLength;if(r.length===1){i=u(e.data.subarray(6,10));i+=10}if(a<i){return}n={data:new Uint8Array(i),frames:[],pts:r[0].pts,dts:r[0].dts};for(l=0;l<i;){n.data.set(r[0].data.subarray(0,i-l),l);l+=r[0].data.byteLength;a-=r[0].data.byteLength;r.shift()}s=10;if(n.data[5]&64){s+=4;s+=u(n.data.subarray(10,14));i-=u(n.data.subarray(16,20))}do{o=u(n.data.subarray(s+4,s+8));if(o<1){return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.")}c=String.fromCharCode(n.data[s],n.data[s+1],n.data[s+2],n.data[s+3]);d={id:c,data:n.data.subarray(s+10,s+o+10)};d.key=d.id;if(f[d.id]){f[d.id](d);if(d.owner==="com.apple.streaming.transportStreamTimestamp"){var h=d.data,p=(h[3]&1)<<30|h[4]<<22|h[5]<<14|h[6]<<6|h[7]>>>2;p*=4;p+=h[7]&3;d.timeStamp=p;if(n.pts===undefined&&n.dts===undefined){n.pts=d.timeStamp;n.dts=d.timeStamp}this.trigger("timestamp",d)}}n.frames.push(d);s+=10;s+=o}while(s<i);this.trigger("data",n)}};d.prototype=new r;t.exports=d},{"../utils/stream":75,"./stream-types":68}],68:[function(e,t,i){arguments[4][36][0].apply(i,arguments)},{dup:36}],69:[function(e,t,i){arguments[4][37][0].apply(i,arguments)},{"../utils/stream":75,dup:37}],70:[function(e,t,i){t.exports={generator:e("./mp4-generator"),Transmuxer:e("./transmuxer").Transmuxer,AudioSegmentStream:e("./transmuxer").AudioSegmentStream,VideoSegmentStream:e("./transmuxer").VideoSegmentStream}},{"./mp4-generator":71,"./transmuxer":72}],71:[function(e,t,i){"use strict";var r=Math.pow(2,32)-1;var n,a,s,o,u,f,d,l,c,h,p,m,v,y,g,b,_,T,w,S,k,O,P,A,E,x,L,I,C,U,D,M,j,B,R,N;(function(){var e;P={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]};if(typeof Uint8Array==="undefined"){return}for(e in P){if(P.hasOwnProperty(e)){P[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]}}A=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);x=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);E=new Uint8Array([0,0,0,1]);L=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);I=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);C={video:L,audio:I};M=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);D=new Uint8Array([0,0,0,0,0,0,0,0]);j=new Uint8Array([0,0,0,0,0,0,0,0]);B=j;R=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);N=j;U=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])})();n=function(e){var t=[],i=0,r,n,a;for(r=1;r<arguments.length;r++){t.push(arguments[r])}r=t.length;while(r--){i+=t[r].byteLength}n=new Uint8Array(i+8);a=new DataView(n.buffer,n.byteOffset,n.byteLength);a.setUint32(0,n.byteLength);n.set(e,4);for(r=0,i=8;r<t.length;r++){n.set(t[r],i);i+=t[r].byteLength}return n};a=function(){return n(P.dinf,n(P.dref,M))};s=function(e){return n(P.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))};o=function(){return n(P.ftyp,A,E,A,x)};b=function(e){return n(P.hdlr,C[e])};u=function(e){return n(P.mdat,e)};g=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,e.duration&255,85,196,0,0]);if(e.samplerate){t[12]=e.samplerate>>>24&255;t[13]=e.samplerate>>>16&255;t[14]=e.samplerate>>>8&255;t[15]=e.samplerate&255}return n(P.mdhd,t)};y=function(e){return n(P.mdia,g(e),b(e.type),d(e))};f=function(e){return n(P.mfhd,new Uint8Array([0,0,0,0,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255]))};d=function(e){return n(P.minf,e.type==="video"?n(P.vmhd,U):n(P.smhd,D),a(),T(e))};l=function(e,t){var i=[],r=t.length;while(r--){i[r]=S(t[r])}return n.apply(null,[P.moof,f(e)].concat(i))};c=function(e){var t=e.length,i=[];while(t--){i[t]=m(e[t])}return n.apply(null,[P.moov,p(4294967295)].concat(i).concat(h(e)))};h=function(e){var t=e.length,i=[];while(t--){i[t]=k(e[t])}return n.apply(null,[P.mvex].concat(i))};p=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n(P.mvhd,t)};_=function(e){var t=e.samples||[],i=new Uint8Array(4+t.length),r,a;for(a=0;a<t.length;a++){r=t[a].flags;i[a+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy}return n(P.sdtp,i)};T=function(e){return n(P.stbl,w(e),n(P.stts,N),n(P.stsc,B),n(P.stsz,R),n(P.stco,j))};(function(){var e,t;w=function(i){return n(P.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),i.type==="video"?e(i):t(i))};e=function(e){var t=e.sps||[],i=e.pps||[],r=[],a=[],s;for(s=0;s<t.length;s++){r.push((t[s].byteLength&65280)>>>8);r.push(t[s].byteLength&255);r=r.concat(Array.prototype.slice.call(t[s]))}for(s=0;s<i.length;s++){a.push((i[s].byteLength&65280)>>>8);a.push(i[s].byteLength&255);a=a.concat(Array.prototype.slice.call(i[s]))}return n(P.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e.width&65280)>>8,e.width&255,(e.height&65280)>>8,e.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n(P.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([t.length]).concat(r).concat([i.length]).concat(a))),n(P.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))};t=function(e){return n(P.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(e.channelcount&65280)>>8,e.channelcount&255,(e.samplesize&65280)>>8,e.samplesize&255,0,0,0,0,(e.samplerate&65280)>>8,e.samplerate&255,0,0]),s(e))}})();v=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,0,(e.duration&4278190080)>>24,(e.duration&16711680)>>16,(e.duration&65280)>>8,e.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(e.width&65280)>>8,e.width&255,0,0,(e.height&65280)>>8,e.height&255,0,0]);return n(P.tkhd,t)};S=function(e){var t,i,a,s,o,u,f;t=n(P.tfhd,new Uint8Array([0,0,0,58,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]));u=Math.floor(e.baseMediaDecodeTime/(r+1));f=Math.floor(e.baseMediaDecodeTime%(r+1));i=n(P.tfdt,new Uint8Array([1,0,0,0,u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255]));o=32+20+8+16+8+8;if(e.type==="audio"){a=O(e,o);return n(P.traf,t,i,a)}s=_(e);a=O(e,s.length+o);return n(P.traf,t,i,a,s)};m=function(e){e.duration=e.duration||4294967295;return n(P.trak,v(e),y(e))};k=function(e){var t=new Uint8Array([0,0,0,0,(e.id&4278190080)>>24,(e.id&16711680)>>16,(e.id&65280)>>8,e.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);if(e.type!=="video"){t[t.length-1]=0}return n(P.trex,t)};(function(){var e,t,i;i=function(e,t){var i=0,r=0,n=0,a=0;if(e.length){if(e[0].duration!==undefined){i=1}if(e[0].size!==undefined){r=2}if(e[0].flags!==undefined){n=4}if(e[0].compositionTimeOffset!==undefined){a=8}}return[0,0,i|r|n|a,1,(e.length&4278190080)>>>24,(e.length&16711680)>>>16,(e.length&65280)>>>8,e.length&255,(t&4278190080)>>>24,(t&16711680)>>>16,(t&65280)>>>8,t&255]};t=function(e,t){var r,a,s,o;a=e.samples||[];t+=8+12+16*a.length;r=i(a,t);for(o=0;o<a.length;o++){s=a[o];r=r.concat([(s.duration&4278190080)>>>24,(s.duration&16711680)>>>16,(s.duration&65280)>>>8,s.duration&255,(s.size&4278190080)>>>24,(s.size&16711680)>>>16,(s.size&65280)>>>8,s.size&255,s.flags.isLeading<<2|s.flags.dependsOn,s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,s.flags.degradationPriority&240<<8,s.flags.degradationPriority&15,(s.compositionTimeOffset&4278190080)>>>24,(s.compositionTimeOffset&16711680)>>>16,(s.compositionTimeOffset&65280)>>>8,s.compositionTimeOffset&255])}return n(P.trun,new Uint8Array(r))};e=function(e,t){var r,a,s,o;a=e.samples||[];t+=8+12+8*a.length;r=i(a,t);for(o=0;o<a.length;o++){s=a[o];r=r.concat([(s.duration&4278190080)>>>24,(s.duration&16711680)>>>16,(s.duration&65280)>>>8,s.duration&255,(s.size&4278190080)>>>24,(s.size&16711680)>>>16,(s.size&65280)>>>8,s.size&255])}return n(P.trun,new Uint8Array(r))};O=function(i,r){if(i.type==="audio"){return e(i,r)}return t(i,r)}})();t.exports={ftyp:o,mdat:u,moof:l,moov:c,initSegment:function(e){var t=o(),i=c(e),r;r=new Uint8Array(t.byteLength+i.byteLength);r.set(t);r.set(i,t.byteLength);return r}}},{}],72:[function(e,t,i){"use strict";var r=e("../utils/stream.js");var n=e("./mp4-generator.js");var a=e("../m2ts/m2ts.js");var s=e("../codecs/adts.js");var o=e("../codecs/h264").H264Stream;var u=e("../aac");var f=e("../data/silence");var d=e("../utils/clock");var l=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"];var c=["width","height","profileIdc","levelIdc","profileCompatibility"];var h=9e4;var p,m,v,y;var g,b,_,T,w,S,k;g=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}}};b=function(e){if(e[0]==="I".charCodeAt(0)&&e[1]==="D".charCodeAt(0)&&e[2]==="3".charCodeAt(0)){return true}return false};S=function(e,t){var i;if(e.length!==t.length){return false}for(i=0;i<e.length;i++){if(e[i]!==t[i]){return false}}return true};k=function(e){var t,i,r=0;for(t=0;t<e.length;t++){i=e[t];r+=i.data.byteLength}return r};m=function(e){var t=[],i=0,r=0,a=0,s=Infinity;m.prototype.init.call(this);this.push=function(i){_(e,i);if(e){l.forEach(function(t){e[t]=i[t]})}t.push(i)};this.setEarliestDts=function(t){r=t-e.timelineStartInfo.baseMediaDecodeTime};this.setVideoBaseMediaDecodeTime=function(e){s=e};this.setAudioAppendStart=function(e){a=e};this.flush=function(){var r,a,s,o;if(t.length===0){this.trigger("done","AudioSegmentStream");return}r=this.trimAdtsFramesByEarliestDts_(t);e.baseMediaDecodeTime=w(e);this.prefixWithSilence_(e,r);e.samples=this.generateSampleTable_(r);s=n.mdat(this.concatenateFrameData_(r));t=[];a=n.moof(i,[e]);o=new Uint8Array(a.byteLength+s.byteLength);i++;o.set(a);o.set(s,a.byteLength);T(e);this.trigger("data",{track:e,boxes:o});this.trigger("done","AudioSegmentStream")};this.prefixWithSilence_=function(e,t){var i,r=0,n=0,o=0,u=0,l,c;if(!t.length){return}i=d.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate);if(a&&s&&a<i){n=i-s;r=Math.ceil(h/(e.samplerate/1024));o=Math.floor(n/r);u=o*r}if(o<1||u>h/2){return}l=f[e.samplerate];if(!l){l=t[0].data}for(c=0;c<o;c++){t.splice(c,0,{data:l})}e.baseMediaDecodeTime-=Math.floor(d.videoTsToAudioTs(u,e.samplerate))};this.trimAdtsFramesByEarliestDts_=function(t){if(e.minSegmentDts>=r){return t}e.minSegmentDts=Infinity;return t.filter(function(t){if(t.dts>=r){e.minSegmentDts=Math.min(e.minSegmentDts,t.dts);e.minSegmentPts=e.minSegmentDts;return true}return false})};this.generateSampleTable_=function(e){var t,i,r=[];for(t=0;t<e.length;t++){i=e[t];r.push({size:i.data.byteLength,duration:1024})}return r};this.concatenateFrameData_=function(e){var t,i,r=0,n=new Uint8Array(k(e));for(t=0;t<e.length;t++){i=e[t];n.set(i.data,r);r+=i.data.byteLength}return n}};m.prototype=new r;p=function(e){var t=0,i=[],r,a;p.prototype.init.call(this);delete e.minPTS;this.gopCache_=[];this.push=function(t){_(e,t);if(t.nalUnitType==="seq_parameter_set_rbsp"&&!r){r=t.config;e.sps=[t.data];c.forEach(function(t){e[t]=r[t]},this)}if(t.nalUnitType==="pic_parameter_set_rbsp"&&!a){a=t.data;e.pps=[t.data]}i.push(t)};this.flush=function(){var r,a,s,o,u,f;while(i.length){if(i[0].nalUnitType==="access_unit_delimiter_rbsp"){break}i.shift()}if(i.length===0){this.resetStream_();this.trigger("done","VideoSegmentStream");return}r=this.groupNalsIntoFrames_(i);s=this.groupFramesIntoGops_(r);if(!s[0][0].keyFrame){a=this.getGopForFusion_(i[0],e);if(a){s.unshift(a);s.byteLength+=a.byteLength;s.nalCount+=a.nalCount;s.pts=a.pts;s.dts=a.dts;s.duration+=a.duration}else{s=this.extendFirstKeyFrame_(s)}}_(e,s);e.samples=this.generateSampleTable_(s);u=n.mdat(this.concatenateNalData_(s));this.gopCache_.unshift({gop:s.pop(),pps:e.pps,sps:e.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);i=[];e.baseMediaDecodeTime=w(e);this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime);this.trigger("timelineStartInfo",e.timelineStartInfo);o=n.moof(t,[e]);f=new Uint8Array(o.byteLength+u.byteLength);t++;f.set(o);f.set(u,o.byteLength);this.trigger("data",{track:e,boxes:f});this.resetStream_();this.trigger("done","VideoSegmentStream")};this.resetStream_=function(){T(e);r=undefined;a=undefined};this.getGopForFusion_=function(t){var i=45e3,r=1e4,n=Infinity,a,s,o,u,f;for(f=0;f<this.gopCache_.length;f++){u=this.gopCache_[f];o=u.gop;if(!(e.pps&&S(e.pps[0],u.pps[0]))||!(e.sps&&S(e.sps[0],u.sps[0]))){continue}if(o.dts<e.timelineStartInfo.dts){continue}a=t.dts-o.dts-o.duration;if(a>=-r&&a<=i){if(!s||n>a){s=u;n=a}}}if(s){return s.gop}return null};this.extendFirstKeyFrame_=function(e){var t;if(!e[0][0].keyFrame){t=e.shift();e.byteLength-=t.byteLength;e.nalCount-=t.nalCount;e[0][0].dts=t.dts;e[0][0].pts=t.pts;e[0][0].duration+=t.duration}return e};this.groupNalsIntoFrames_=function(e){var t,i,r=[],n=[];r.byteLength=0;for(t=0;t<e.length;t++){i=e[t];if(i.nalUnitType==="access_unit_delimiter_rbsp"){if(r.length){r.duration=i.dts-r.dts;n.push(r)}r=[i];r.byteLength=i.data.byteLength;r.pts=i.pts;r.dts=i.dts}else{if(i.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"){r.keyFrame=true}r.duration=i.dts-r.dts;r.byteLength+=i.data.byteLength;r.push(i)}}if(n.length&&(!r.duration||r.duration<=0)){r.duration=n[n.length-1].duration}n.push(r);return n};this.groupFramesIntoGops_=function(e){var t,i,r=[],n=[];r.byteLength=0;r.nalCount=0;r.duration=0;r.pts=e[0].pts;r.dts=e[0].dts;n.byteLength=0;n.nalCount=0;n.duration=0;n.pts=e[0].pts;n.dts=e[0].dts;for(t=0;t<e.length;t++){i=e[t];if(i.keyFrame){if(r.length){n.push(r);n.byteLength+=r.byteLength;n.nalCount+=r.nalCount;n.duration+=r.duration}r=[i];r.nalCount=i.length;r.byteLength=i.byteLength;r.pts=i.pts;r.dts=i.dts;r.duration=i.duration}else{r.duration+=i.duration;r.nalCount+=i.length;r.byteLength+=i.byteLength;r.push(i)}}if(n.length&&r.duration<=0){r.duration=n[n.length-1].duration}n.byteLength+=r.byteLength;n.nalCount+=r.nalCount;n.duration+=r.duration;n.push(r);return n};this.generateSampleTable_=function(e,t){var i,r,n,a,s,o=t||0,u=[];for(i=0;i<e.length;i++){a=e[i];for(r=0;r<a.length;r++){s=a[r];n=g();n.dataOffset=o;n.compositionTimeOffset=s.pts-s.dts;n.duration=s.duration;n.size=4*s.length;n.size+=s.byteLength;if(s.keyFrame){n.flags.dependsOn=2}o+=n.size;u.push(n)}}return u};this.concatenateNalData_=function(e){var t,i,r,n,a,s,o=0,u=e.byteLength,f=e.nalCount,d=u+4*f,l=new Uint8Array(d),c=new DataView(l.buffer);for(t=0;t<e.length;t++){n=e[t];for(i=0;i<n.length;i++){a=n[i];for(r=0;r<a.length;r++){s=a[r];c.setUint32(o,s.data.byteLength);o+=4;l.set(s.data,o);o+=s.data.byteLength}}}return l}};p.prototype=new r;_=function(e,t){if(typeof t.pts==="number"){if(e.timelineStartInfo.pts===undefined){e.timelineStartInfo.pts=t.pts}if(e.minSegmentPts===undefined){e.minSegmentPts=t.pts}else{e.minSegmentPts=Math.min(e.minSegmentPts,t.pts)}if(e.maxSegmentPts===undefined){e.maxSegmentPts=t.pts}else{e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)}}if(typeof t.dts==="number"){if(e.timelineStartInfo.dts===undefined){e.timelineStartInfo.dts=t.dts}if(e.minSegmentDts===undefined){e.minSegmentDts=t.dts}else{e.minSegmentDts=Math.min(e.minSegmentDts,t.dts)}if(e.maxSegmentDts===undefined){e.maxSegmentDts=t.dts}else{e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts)}}};T=function(e){delete e.minSegmentDts;delete e.maxSegmentDts;delete e.minSegmentPts;delete e.maxSegmentPts};w=function(e){var t,i,r=e.minSegmentDts-e.timelineStartInfo.dts;t=e.timelineStartInfo.baseMediaDecodeTime;t+=r;t=Math.max(0,t);if(e.type==="audio"){i=e.samplerate/h;t*=i;t=Math.floor(t)}return t};y=function(e,t){this.numberOfTracks=0;this.metadataStream=t;if(typeof e.remux!=="undefined"){this.remuxTracks=!!e.remux}else{this.remuxTracks=true}this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;y.prototype.init.call(this);this.push=function(e){if(e.text){return this.pendingCaptions.push(e)}if(e.frames){return this.pendingMetadata.push(e)}this.pendingTracks.push(e.track);this.pendingBoxes.push(e.boxes);this.pendingBytes+=e.boxes.byteLength;if(e.track.type==="video"){this.videoTrack=e.track}if(e.track.type==="audio"){this.audioTrack=e.track}}};y.prototype=new r;y.prototype.flush=function(e){var t=0,i={captions:[],metadata:[],info:{}},r,a,s,o=0,u;if(this.pendingTracks.length<this.numberOfTracks){if(e!=="VideoSegmentStream"&&e!=="AudioSegmentStream"){return}else if(this.remuxTracks){return}else if(this.pendingTracks.length===0){this.emittedTracks++;if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}return}}if(this.videoTrack){o=this.videoTrack.timelineStartInfo.pts;c.forEach(function(e){i.info[e]=this.videoTrack[e]},this)}else if(this.audioTrack){o=this.audioTrack.timelineStartInfo.pts;l.forEach(function(e){i.info[e]=this.audioTrack[e]},this)}if(this.pendingTracks.length===1){i.type=this.pendingTracks[0].type}else{i.type="combined"}this.emittedTracks+=this.pendingTracks.length;s=n.initSegment(this.pendingTracks);i.initSegment=new Uint8Array(s.byteLength);i.initSegment.set(s);i.data=new Uint8Array(this.pendingBytes);for(u=0;u<this.pendingBoxes.length;u++){i.data.set(this.pendingBoxes[u],t);t+=this.pendingBoxes[u].byteLength}for(u=0;u<this.pendingCaptions.length;u++){r=this.pendingCaptions[u];r.startTime=r.startPts-o;r.startTime/=9e4;r.endTime=r.endPts-o;r.endTime/=9e4;i.captions.push(r)}for(u=0;u<this.pendingMetadata.length;u++){a=this.pendingMetadata[u];a.cueTime=a.pts-o;a.cueTime/=9e4;i.metadata.push(a)}i.metadata.dispatchType=this.metadataStream.dispatchType;this.pendingTracks.length=0;this.videoTrack=null;this.pendingBoxes.length=0;this.pendingCaptions.length=0;this.pendingBytes=0;this.pendingMetadata.length=0;this.trigger("data",i);if(this.emittedTracks>=this.numberOfTracks){this.trigger("done");this.emittedTracks=0}};v=function(e){var t=this,i=true,r,n;v.prototype.init.call(this);e=e||{};this.baseMediaDecodeTime=e.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var i={};this.transmuxPipeline_=i;i.type="aac";i.metadataStream=new a.MetadataStream;i.aacStream=new u;i.audioTimestampRolloverStream=new a.TimestampRolloverStream("audio");i.timedMetadataTimestampRolloverStream=new a.TimestampRolloverStream("timed-metadata");i.adtsStream=new s;i.coalesceStream=new y(e,i.metadataStream);i.headOfPipeline=i.aacStream;i.aacStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream);i.aacStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream);i.metadataStream.on("timestamp",function(e){i.aacStream.setTimestamp(e.timeStamp)});i.aacStream.on("data",function(e){if(e.type==="timed-metadata"&&!i.audioSegmentStream){n=n||{timelineStartInfo:{baseMediaDecodeTime:t.baseMediaDecodeTime},codec:"adts",type:"audio"};i.coalesceStream.numberOfTracks++;i.audioSegmentStream=new m(n);i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)}});i.coalesceStream.on("data",this.trigger.bind(this,"data"));i.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var i={};this.transmuxPipeline_=i;i.type="ts";i.metadataStream=new a.MetadataStream;i.packetStream=new a.TransportPacketStream;i.parseStream=new a.TransportParseStream;i.elementaryStream=new a.ElementaryStream;i.videoTimestampRolloverStream=new a.TimestampRolloverStream("video");i.audioTimestampRolloverStream=new a.TimestampRolloverStream("audio");i.timedMetadataTimestampRolloverStream=new a.TimestampRolloverStream("timed-metadata");i.adtsStream=new s;i.h264Stream=new o;i.captionStream=new a.CaptionStream;i.coalesceStream=new y(e,i.metadataStream);i.headOfPipeline=i.packetStream;i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream);i.elementaryStream.pipe(i.videoTimestampRolloverStream).pipe(i.h264Stream);i.elementaryStream.pipe(i.audioTimestampRolloverStream).pipe(i.adtsStream);i.elementaryStream.pipe(i.timedMetadataTimestampRolloverStream).pipe(i.metadataStream).pipe(i.coalesceStream);i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream);i.elementaryStream.on("data",function(e){var a;if(e.type==="metadata"){a=e.tracks.length;while(a--){if(!r&&e.tracks[a].type==="video"){r=e.tracks[a];r.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}else if(!n&&e.tracks[a].type==="audio"){n=e.tracks[a];n.timelineStartInfo.baseMediaDecodeTime=t.baseMediaDecodeTime}}if(r&&!i.videoSegmentStream){i.coalesceStream.numberOfTracks++;i.videoSegmentStream=new p(r);i.videoSegmentStream.on("timelineStartInfo",function(e){if(n){n.timelineStartInfo=e;i.audioSegmentStream.setEarliestDts(e.dts)}});i.videoSegmentStream.on("baseMediaDecodeTime",function(e){if(n){i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}});i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)}if(n&&!i.audioSegmentStream){i.coalesceStream.numberOfTracks++;i.audioSegmentStream=new m(n);i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)}}});i.coalesceStream.on("data",this.trigger.bind(this,"data"));i.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;this.baseMediaDecodeTime=e;if(n){n.timelineStartInfo.dts=undefined;n.timelineStartInfo.pts=undefined;T(n);n.timelineStartInfo.baseMediaDecodeTime=e}if(r){if(t.videoSegmentStream){t.videoSegmentStream.gopCache_=[]}r.timelineStartInfo.dts=undefined;r.timelineStartInfo.pts=undefined;T(r);r.timelineStartInfo.baseMediaDecodeTime=e}};this.setAudioAppendStart=function(e){if(n){this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)}};this.push=function(e){if(i){var t=b(e);if(t&&this.transmuxPipeline_.type!=="aac"){this.setupAacPipeline()}else if(!t&&this.transmuxPipeline_.type!=="ts"){this.setupTsPipeline()}i=false}this.transmuxPipeline_.headOfPipeline.push(e)};this.flush=function(){i=true;this.transmuxPipeline_.headOfPipeline.flush()}};v.prototype=new r;t.exports={Transmuxer:v,VideoSegmentStream:p,AudioSegmentStream:m,AUDIO_PROPERTIES:l,VIDEO_PROPERTIES:c}},{"../aac":55,"../codecs/adts.js":56,"../codecs/h264":57,"../data/silence":58,"../m2ts/m2ts.js":66,"../utils/clock":73,"../utils/stream.js":75,"./mp4-generator.js":71}],73:[function(e,t,i){var r=9e4,n,a,s,o,u,f;n=function(e){return e*r};a=function(e,t){return e*t};s=function(e){return e/r};o=function(e,t){return e/t};u=function(e,t){return n(o(e,t))};f=function(e,t){return a(s(e),t)};t.exports={secondsToVideoTs:n,secondsToAudioTs:a,videoTsToSeconds:s,audioTsToSeconds:o,audioTsToVideoTs:u,videoTsToAudioTs:f}},{}],74:[function(e,t,i){"use strict";var r;r=function(e){var t=e.byteLength,i=0,r=0;this.length=function(){return 8*t};this.bitsAvailable=function(){return 8*t+r};this.loadWord=function(){var n=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(s===0){throw new Error("no bytes available")}a.set(e.subarray(n,n+s));i=new DataView(a.buffer).getUint32(0);r=s*8;t-=s};this.skipBits=function(e){var n;if(r>e){i<<=e;r-=e}else{e-=r;n=Math.floor(e/8);e-=n*8;t-=n;this.loadWord();i<<=e;r-=e}};this.readBits=function(e){var n=Math.min(r,e),a=i>>>32-n;r-=n;if(r>0){i<<=n}else if(t>0){this.loadWord()}n=e-n;if(n>0){return a<<n|this.readBits(n)}return a};this.skipLeadingZeros=function(){var e;for(e=0;e<r;++e){if((i&2147483648>>>e)!==0){i<<=e;r-=e;return e}}this.loadWord();return e+this.skipLeadingZeros()};this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1};this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();if(1&e){return 1+e>>>1}return-1*(e>>>1)};this.readBoolean=function(){return this.readBits(1)===1};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};t.exports=r},{}],75:[function(e,t,i){arguments[4][40][0].apply(i,arguments)},{dup:40}],76:[function(e,t,i){var r=arguments[3];var n=arguments[4];var a=arguments[5];var s=JSON.stringify;t.exports=function(e){var t=[];var i;var o=Object.keys(a);for(var u=0,f=o.length;u<f;u++){var d=o[u];if(a[d].exports===e){i=d;break}}if(!i){i=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var l={};for(var u=0,f=o.length;u<f;u++){var d=o[u];l[d]=d}n[i]=[Function(["require","module","exports"],"("+e+")(self)"),l]}var c=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var h={};h[i]=i;n[c]=[Function(["require"],"require("+s(i)+")(self)"),h];var p="("+r+")({"+Object.keys(n).map(function(e){return s(e)+":["+n[e][0]+","+s(n[e][1])+"]"}).join(",")+"},{},["+s(c)+"])";var m=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(m.createObjectURL(new Blob([p],{type:"text/javascript"})))}},{}],77:[function(e,t,i){arguments[4][76][0].apply(i,arguments)},{dup:76}],78:[function(e,t,i){(function(i){"use strict";var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,i,r){if(i)e(t.prototype,i);if(r)e(t,r);return t}}();var n=function e(t,i,r){var n=true;e:while(n){var a=t,s=i,o=r;n=false;if(a===null)a=Function.prototype;var u=Object.getOwnPropertyDescriptor(a,s);if(u===undefined){var f=Object.getPrototypeOf(a);if(f===null){return undefined}else{t=f;i=s;r=o;n=true;u=f=undefined;continue e}}else if("value"in u){return u.value}else{var d=u.get;if(d===undefined){return undefined}return d.call(o)}}};function a(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function o(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var u=e("global/document");var f=a(u);var d=e("./playlist-loader");var l=a(d);var c=e("./playlist");var h=a(c);var p=e("./xhr");var m=a(p);var v=e("aes-decrypter");var y=e("./bin-utils");var g=a(y);var b=e("videojs-contrib-media-sources");var _=e("m3u8-parser");var T=a(_);var w=typeof window!=="undefined"?window["videojs"]:typeof i!=="undefined"?i["videojs"]:null;var S=a(w);var k=e("./master-playlist-controller");var O=e("./config");var P=a(O);var A=e("./rendition-mixin");var E=a(A);var x=e("global/window");var L=a(x);var I=e("./playback-watcher");var C=a(I);var U=e("./reload-source-on-error");var D=a(U);var M={PlaylistLoader:l["default"],Playlist:h["default"],Decrypter:v.Decrypter,AsyncStream:v.AsyncStream,decrypt:v.decrypt,utils:g["default"],xhr:(0,m["default"])()};Object.defineProperty(M,"GOAL_BUFFER_LENGTH",{get:function e(){S["default"].log.warn("using Hls.GOAL_BUFFER_LENGTH is UNSAFE be sure "+"you know what you are doing");return P["default"].GOAL_BUFFER_LENGTH},set:function e(t){S["default"].log.warn("using Hls.GOAL_BUFFER_LENGTH is UNSAFE be sure "+"you know what you are doing");if(typeof t!=="number"||t<=0){S["default"].log.warn("value passed to Hls.GOAL_BUFFER_LENGTH "+"must be a number and greater than 0");return}P["default"].GOAL_BUFFER_LENGTH=t}});var j=1.2;var B=function e(t,i){var r=undefined;if(!t){return""}r=L["default"].getComputedStyle(t);if(!r){return""}return r[i]};var R=function e(t,i){var r=i.media();var n=-1;for(var a=0;a<t.length;a++){if(t[a].id===r.uri){n=a;break}}t.selectedIndex_=n;t.trigger({selectedIndex:n,type:"change"})};var N=function e(t,i){i.representations().forEach(function(e){t.addQualityLevel(e)});R(t,i.playlists)};var F=function e(t,i){var r=t.slice();t.sort(function(e,t){var n=i(e,t);if(n===0){return r.indexOf(e)-r.indexOf(t)}return n})};M.STANDARD_PLAYLIST_SELECTOR=function(){var e=this.playlists.master.playlists.slice();var t=[];var i=undefined;var r=undefined;var n=undefined;var a=undefined;var s=undefined;var o=undefined;var u=undefined;var f=[];var d=[];var l=[];F(e,M.comparePlaylistBandwidth);e=e.filter(h["default"].isEnabled);o=this.systemBandwidth;t=e.filter(function(e){return e.attributes&&e.attributes.BANDWIDTH&&e.attributes.BANDWIDTH*j<o});i=t.filter(function(e){return e.attributes.BANDWIDTH===t[t.length-1].attributes.BANDWIDTH})[0];F(t,M.comparePlaylistResolution);a=parseInt(B(this.tech_.el(),"width"),10);s=parseInt(B(this.tech_.el(),"height"),10);u=t.filter(function(e){return e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&e.attributes.RESOLUTION.height});l=u.filter(function(e){return e.attributes.RESOLUTION.width===a&&e.attributes.RESOLUTION.height===s});n=l.filter(function(e){return e.attributes.BANDWIDTH===l[l.length-1].attributes.BANDWIDTH})[0];if(!n){f=u.filter(function(e){return e.attributes.RESOLUTION.width>a||e.attributes.RESOLUTION.height>s});d=f.filter(function(e){return e.attributes.RESOLUTION.width===f[0].attributes.RESOLUTION.width&&e.attributes.RESOLUTION.height===f[0].attributes.RESOLUTION.height});r=d.filter(function(e){return e.attributes.BANDWIDTH===d[d.length-1].attributes.BANDWIDTH})[0]}return r||n||i||e[0]};M.canPlaySource=function(){return S["default"].log.warn("HLS is no longer a tech. Please remove it from "+"your player's techOrder.")};M.supportsNativeHls=function(){var e=f["default"].createElement("video");if(!S["default"].getTech("Html5").isSupported()){return false}var t=["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"];return t.some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}();M.isSupported=function(){return S["default"].log.warn("HLS is no longer a tech. Please remove it from "+"your player's techOrder.")};var G=L["default"].navigator&&L["default"].navigator.userAgent||"";M.supportsAudioInfoChange_=function(){if(S["default"].browser.IS_FIREFOX){var e=/Firefox\/([\d.]+)/i.exec(G);var t=parseInt(e[1],10);return t>=49}return true};var q=S["default"].getComponent("Component");var H=function(e){o(t,e);function t(e,i,r){var a=this;s(this,t);n(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,i);if(i.options_&&i.options_.playerId){var o=(0,S["default"])(i.options_.playerId);if(!o.hasOwnProperty("hls")){Object.defineProperty(o,"hls",{get:function e(){S["default"].log.warn("player.hls is deprecated. Use player.tech_.hls instead.");return a}})}}if(S["default"].options.hls.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks)){throw new Error("Overriding native HLS requires emulated tracks. "+"See https://git.io/vMpjB")}this.tech_=i;this.source_=e;this.stats={};this.ignoreNextSeekingEvent_=false;this.options_=S["default"].mergeOptions(S["default"].options.hls||{},r.hls);this.setOptions_();this.on(f["default"],["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=f["default"].fullscreenElement||f["default"].webkitFullscreenElement||f["default"].mozFullScreenElement||f["default"].msFullscreenElement;if(t&&t.contains(a.tech_.el())){a.masterPlaylistController_.fastQualityChange_()}});this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=false;return}this.setCurrentTime(this.tech_.currentTime())});this.on(this.tech_,"error",function(){if(this.masterPlaylistController_){this.masterPlaylistController_.pauseLoading()}});this.audioTrackChange_=function(){a.masterPlaylistController_.setupAudio()};this.on(this.tech_,"play",this.play)}r(t,[{key:"setOptions_",value:function e(){var t=this;this.options_.withCredentials=this.options_.withCredentials||false;if(typeof this.options_.bandwidth!=="number"){this.options_.bandwidth=4194304}["withCredentials","bandwidth"].forEach(function(e){if(typeof t.source_[e]!=="undefined"){t.options_[e]=t.source_[e]}});this.bandwidth=this.options_.bandwidth}},{key:"src",value:function e(t){var i=this;if(!t){return}this.setOptions_();this.options_.url=this.source_.src;this.options_.tech=this.tech_;this.options_.externHls=M;this.masterPlaylistController_=new k.MasterPlaylistController(this.options_);this.playbackWatcher_=new C["default"](S["default"].mergeOptions(this.options_,{seekable:function e(){return i.seekable()}}));this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):M.STANDARD_PLAYLIST_SELECTOR.bind(this);this.playlists=this.masterPlaylistController_.masterPlaylistLoader_;this.mediaSource=this.masterPlaylistController_.mediaSource;Object.defineProperties(this,{selectPlaylist:{get:function e(){return this.masterPlaylistController_.selectPlaylist},set:function e(t){this.masterPlaylistController_.selectPlaylist=t.bind(this)}},throughput:{get:function e(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function e(t){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=t;this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function e(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function e(t){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=t;this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function e(){var t=1/(this.bandwidth||1);var i=undefined;if(this.throughput>0){i=1/this.throughput}else{i=0}var r=Math.floor(1/(t+i));return r},set:function e(){S["default"].log.error('The "systemBandwidth" property is read-only')}}});Object.defineProperties(this.stats,{bandwidth:{get:function e(){return i.bandwidth||0},enumerable:true},mediaRequests:{get:function e(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:true},mediaTransferDuration:{get:function e(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:true},mediaBytesTransferred:{get:function e(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:true},mediaSecondsLoaded:{get:function e(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:true}});this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));this.masterPlaylistController_.on("sourceopen",function(){i.tech_.audioTracks().addEventListener("change",i.audioTrackChange_)});this.masterPlaylistController_.on("selectedinitialmedia",function(){(0,E["default"])(i)});this.masterPlaylistController_.on("audioupdate",function(){i.tech_.clearTracks("audio");i.masterPlaylistController_.activeAudioGroup().forEach(function(e){i.tech_.audioTracks().addTrack(e)})});this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")});this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=true});this.tech_.ready(function(){return i.setupQualityLevels_()});if(!this.tech_.el()){return}this.tech_.src(S["default"].URL.createObjectURL(this.masterPlaylistController_.mediaSource))}},{key:"setupQualityLevels_",value:function e(){var t=this;var i=S["default"].players[this.tech_.options_.playerId];if(i&&i.qualityLevels){this.qualityLevels_=i.qualityLevels();this.masterPlaylistController_.on("selectedinitialmedia",function(){N(t.qualityLevels_,t)});this.playlists.on("mediachange",function(){R(t.qualityLevels_,t.playlists)})}}},{key:"activeAudioGroup_",value:function e(){return this.masterPlaylistController_.activeAudioGroup()}},{key:"play",value:function e(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function e(t){this.masterPlaylistController_.setCurrentTime(t)}},{key:"duration",value:function e(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function e(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value:function e(){if(this.playbackWatcher_){this.playbackWatcher_.dispose()}if(this.masterPlaylistController_){this.masterPlaylistController_.dispose()}if(this.qualityLevels_){this.qualityLevels_.dispose()}this.tech_.audioTracks().removeEventListener("change",this.audioTrackChange_);n(Object.getPrototypeOf(t.prototype),"dispose",this).call(this)}}]);return t}(q);var V=function e(t){return{canHandleSource:function i(r){if(S["default"].options.hls&&S["default"].options.hls.mode&&S["default"].options.hls.mode!==t){return false}return e.canPlayType(r.type)},handleSource:function e(i,r,n){if(t==="flash"){r.setTimeout(function(){r.trigger("loadstart")},1)}var a=S["default"].mergeOptions(n,{hls:{mode:t}});r.hls=new H(i,r,a);r.hls.xhr=(0,m["default"])();if(S["default"].Hls.xhr.beforeRequest){r.hls.xhr.beforeRequest=S["default"].Hls.xhr.beforeRequest}r.hls.src(i.src);return r.hls},canPlayType:function t(i){if(e.canPlayType(i)){return"maybe"}return""}}};M.comparePlaylistBandwidth=function(e,t){var i=undefined;var r=undefined;if(e.attributes&&e.attributes.BANDWIDTH){i=e.attributes.BANDWIDTH}i=i||L["default"].Number.MAX_VALUE;if(t.attributes&&t.attributes.BANDWIDTH){r=t.attributes.BANDWIDTH}r=r||L["default"].Number.MAX_VALUE;return i-r};M.comparePlaylistResolution=function(e,t){var i=undefined;var r=undefined;if(e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width){i=e.attributes.RESOLUTION.width}i=i||L["default"].Number.MAX_VALUE;if(t.attributes&&t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width){r=t.attributes.RESOLUTION.width}r=r||L["default"].Number.MAX_VALUE;if(i===r&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH){return e.attributes.BANDWIDTH-t.attributes.BANDWIDTH}return i-r};V.canPlayType=function(e){if(S["default"].browser.IE_VERSION&&S["default"].browser.IE_VERSION<=10){return false}var t=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;if(!S["default"].options.hls.overrideNative&&M.supportsNativeHls){return false}return t.test(e)};if(typeof S["default"].MediaSource==="undefined"||typeof S["default"].URL==="undefined"){S["default"].MediaSource=b.MediaSource;S["default"].URL=b.URL}var X=S["default"].getTech("Flash");if(b.MediaSource.supportsNativeMediaSources()){S["default"].getTech("Html5").registerSourceHandler(V("html5"),0)}if(L["default"].Uint8Array&&X){X.registerSourceHandler(V("flash"))}S["default"].HlsHandler=H;S["default"].HlsSourceHandler=V;S["default"].Hls=M;if(!S["default"].use){S["default"].registerComponent("Hls",M)}S["default"].m3u8=T["default"];S["default"].options.hls=S["default"].options.hls||{};if(S["default"].registerPlugin){S["default"].registerPlugin("reloadSourceOnError",D["default"])}else{S["default"].plugin("reloadSourceOnError",D["default"])}t.exports={Hls:M,HlsHandler:H,HlsSourceHandler:V}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./bin-utils":2,"./config":3,"./master-playlist-controller":5,"./playback-watcher":6,"./playlist":8,"./playlist-loader":7,"./reload-source-on-error":10,"./rendition-mixin":11,"./xhr":17,"aes-decrypter":21,"global/document":27,"global/window":28,"m3u8-parser":29,"videojs-contrib-media-sources":53}]},{},[78])(78)});